I have written a demonstration of a simple path-finding algorithm (in Python), for use in grid-based computer games. It used a breadth-first search to route a sprite from one part of a map to another, avoiding obstacles in between. The code is a listing taken from my forthcoming book, Beginning Game Development with Python and Pygame. There's no documentation I'm afraid. If you want to know how it works, you will have to buy the book. :-)

Download path finding demo

To run it, you will need PyGame, and of course Python. The code is completely public domain, use it for whatever purpose you want and you don't owe me a penny. Here be a screenshot...

fuguswim
This blog post was posted to It's All Geek to Me on Friday April 20th, 2007 at 6:07PM
 

5 Responses to "Swim Fugu, Swim"

  • Jay P
    April 20th, 2007, 7:17 p.m.

    Amazon is saying August for publishing. Any chance it'll be out earlier?

  • April 20th, 2007, 7:33 p.m.

    Sorry, it's unlikely to be out any earlier!

  • April 21st, 2007, 10:34 p.m.

    Excellent. I can't wait to get a hold of this book, although it will be little new to me, I want something to recommend to my friends and the newcomers to #python @ freenode who are always asking for good books. Good luck!

  • July 11th, 2007, 5:35 a.m.

    Looks like a neat book. I might be able to make my computer science teacher get a copy or two, and we can use them for our after-school programming stuff. I'm not too great on teaching this stuff.

  • July 27th, 2007, 11:29 a.m.

    I cant wait to buy the book! :D

Leave a Comment

You can use bbcode in the comment: e.g. [b]This is bold[/b], [url]http://www.willmcgugan.com[/url], [code python]import this[/code]
Preview Posting...
Previewing comment, please wait a moment...

My Tweets

Will McGugan

My name is Will McGugan. I am an unabashed geek, an author, a hacker and a Python expert – amongst other things!

Search for Posts
Possibly related posts
Tags
Popular Tags
 
Archives
2015
 
Recent Comments
using of a recursion: def thousands_with_commas(i): def _recurse(n): x, y = divmod(n, 1000) if x 1000: return [x, y] return ...
#1 import string from collections import Counter def tagwords(): tagcounter = Counter() with open(tagwords.txt, r) as wordfile: words = list(filter(None, ...
- the jeffster on Python Coder Test
This is because mod_wsgi does not pass OS environment variables to the underlying application by default
Aigars, I didn't know uwsgi had such features. Thanks for the heads up.
Good example code. It could be updated to expose today's rendering techniques (anything that does not use glBegin/glEnd calls).
- Jorge A. Gomes on OpenGL sample code for PyGame
 
© 2008 Will McGugan.

A technoblog blog, design by Will McGugan