alexspy Alex's .py alexspy

Hi, I'm Alex. I created this Python blog to show people the latest games and code I'm working on, along with explanations and examples for anyone looking to learn more about Python, CGI / server-side programming, or just internet game development in general. Let me know what you think, and thanks for visiting!



Sept 1, 2012 : hangman_game.py

Here's a breakdown of how the hangman_game.py source code works, in 6 easy steps...
  1. Test if a new game should be initiated. If so, choose a new mystery word and initialize the game variables...



  2. If not, then import the current game info and store as local variables...



  3. Check if the entered letter occurs in the mystery word, if so then update the mystery display to reveal the guessed letter, if not then increase the guess counter...



  4. Check if the game is over, if so, update comments accordingly...



  5. Generate the hangman ASCII art based on how many incorrect guesses have been entered this game...



  6. Print the hangman display to HTML, and all essential game info as hidden CGI input...






Here's some other great python blogs I like to check out:

Nadia Alramli's Blog
The "Invent with Python" Blog
Carter Sande's Blog