Possibility and Probability

Python, AI, and other fun stuff

7/20/2004

State Machines

Even though it is one of the highest rated recipes in the on-line python cookbook, I thought I would take a moment to point it out. I haven't used this code yet, but I'm looking forward to it. This design strikes me a simple yet highly effective.

I've always thought state machines were interesting. I worked at one company (Intellivoice Communications) where the main product was driven by a state machine that was scriptable. I really liked it because it allowed us to take a flowchart of how the program was to function and pretty much write the script code to perform that way. Personally I think it helped everyone involved visualize what the system was doing.

And ever since working there, I've tried to look at all programs as a state machine. If nothing else it does help me with debugging, it forces me to start at the beginning work my way to the problem.

At any rate, I have an itch to do write an Wasteland style RPG and after looking at pygame and this recipe I think I'm going to go ahead and go for it.

Well, maybe I should fix the slidepuzzle first. It would be nice to know when a game has been won... ;)

Comment on this post [ so far] ... more like this: [python]