Saturday, March 19, 2011

A-mazing we will go.


Have been goofing around a lot lately with recursion, cellular automata, and Pygame.  Working with students to develop a floor-plan generator for dungeons and mazes has led to some fun programs.  The image above is from a Python program that creates a depth-first search maze, and then attempts to solve it using a slightly different algorithm.  The beginning square is the far upper left, and the ending is the far lower right.  White corridors have never been visited.  The pink ones were visited but led to dead ends.  The green path, however, is the correct solution.

Currently working on a version that goes beyond mazes to dungeon-like floor plans.  The program will print out the data to a text file to be used by other programs and other languages.

No comments:

Post a Comment