Code Project: Build an IRC bot

Code

Here at TuxRadar we love quick little programming projects, and hope you do too. The word 'projects' is important here: we're not going to dwell on theory or mundane technical gubbins, but instead look at making cool things - after all, programming is the most fun when you're actually making things rather than spending hours learning about tedious loop constructs!

In this tutorial we're going to produce an IRC bot written in Perl. If you're an old-school internetter, you'll probably have used IRC before; if not, see the Hang on, what is IRC? box explaining the basics overpage. In a nutshell, IRC is a real-time chat protocol, commonly used in open source projects for interaction between developers. It's simple, fast and easy to understand - and best of all, it lets you create virtual participants in the conversation.

Code Project: Build a Space Invaders clone

Code

Programming is great. You get to create something new, stimulate your brain and have fun along the way - especially if you're programming games. So we're going to show you how to write your very own Space Invaders lookalike called PyInvaders - but don't panic if you're tired of dull programming theory: take that palm away from your forehead. Here we'll focus on doing Cool Stuff(tm), making a game work instead of warbling about algorithms, data structures and object oriented polymorphism encapsulation. Or whatever.

Consequently, to follow this guide it helps if you have some prior programming experience. We're not going to explain everything in depth; if you've dabbled in some code before, and know your arrays from your elbow, you won't have any problems. For those completely new to programming, you might find some of the terminology a bit bamboozling, but you don't have to understand it all. Just take in what you can, grab the source code from the DVD and start experimenting by making changes yourself. That's how all great programmers got started!

So, as mentioned, we'll be making a mini Space Invaders clone. Our choice of programming language is Python due to its simple syntax and code cleanliness - it's very easy to read. PyGame, a language binding that wraps the SDL multi-media library around Python, will provide the graphical plumbing for our program, saving us from the chore of manipulating images by hand. Most distros have Python pre-installed, and PyGame is available in nigh-on every repository, so get the tools, open up a text editor, and let's get cracking...

Username:   Password: