

Learn Python by writing games (free book) - larrykubin
http://inventwithpython.com/chapters/

======
selven
I have written very many games using Python and Pygame. Very nice language (I
like the syntax much better than the C-like languages) and tools.

If you're going to do this, there is one very important tip: use psyco. It (
<http://psyco.sourceforge.net/> ) magically speeds up all Python execution by
about 3-4x. In one of my games ( <https://sourceforge.net/projects/slasha/> ,
still in its early stages) the millisecond per frame count went from 25-300 to
15-80 (drawing the desktop seems to take an unavoidable 7-10 ms).

As for what you learn doing this kind of thing, you use trigonometry a lot,
you use the pythagorean theorem a lot, my game here is the way I thought up of
the pathfinding algorithm.

------
jacquesm
That's a great way to get kids in to programming, games are very low 'barrier
to entry' and as they get more sophisticated will cause the wanna be
programmer to pick up a whole pile of knowledge about other fields (such as
physics) as well.

Highly recommended, and at that price you really can't go wrong :)

~~~
nimrody
Might be easier to use Javascript for this purpose since it is available
practically everywhere. And HTML Canvas support makes writing graphics/games
very easy.

See <http://billmill.org/static/canvastutorial/index.html> for example.

------
rbanffy
Seems to be a very good book. I would love to help translate it into
Portuguese so kids around me could make use of it.

If there's still time, I would suggest not using the box image for variables.
I prefer label tags because the box analogy assumes certain objects fit in
certain boxes and is, thus, typed (unlike Python, where objects have types and
names are just names). Also, an object can be contained in a single box while
any number of labels can be attached to any object.

~~~
cabalamat
I agree. Labels better capture how Python works, because the assignmest
statement causes another variable to point to the same object instead of
copying the object, e.g.:

    
    
      >>> a = [1,2]
      >>> b = a
      >>> a[0]='h'
      >>> b
      ['h', 2]

------
cabalamat
One problem with this book is it doesn't teach good programming style. For
example, the program in chapter 19 is 200 lines of code that _doesn't use
procedures anywhere_ \-- it's all in one big lump of code.

This is bad, because when novice programmers try to modify the program, they
will quickly find it becomes unmaintainable.

------
sam191
I was going to recommend this book to my younger brother. However, I changed
my mind shortly after discovering that this book does not cover classes! I
might not be an expert, but almost every Python program I've read uses
classes, and I think it would be difficult for a beginner to read the code of
others after finishing this book.

------
cool-RR
This might be a good place to mention my project again:

<http://pythonturtle.org>

It's not nearly as comprehensive as Invent with Python, but it also attempts
to deal with the challenge of giving a low 'barrier to entry' to learning
Python.

------
illumen
Very nice! So many people first started making little games on their
computers, it makes sense to teach people this way.

