Conway's Game of Life is a classic cellular automaton game. It has no players and only 3 rules. This makes it a great candidate for use in exercises that you want to be able to complete in a short time.
For anyone who hasn't written an implementation of Conway's Game of Life before here are some links that might be helpful to look up as reference material:
-
A whole community of tools and discussion http://conwaylife.com/
-
A google search of "Conway's Game of Life" will render a little javascript version of the game on the sides of the search results.
-
A screencast of Ryan Bigg implementing the game in ruby with tests
It is usually easiest to implement Conway's game of life in such a way that you start with just a text file that represents the initial state of the world. Generally these files represent dead cells with "." and live cells with "o". See the examples directory.
Your program will generally start by parsing the initial state and then running a loop that does something like:
- Clear the terminal (the ANSI escape sequence to clear the terminal and move to the top-left is "\033[2J\033[1;1H")
- Print the current board as a string
- Apply the 3 rules to update the board
- Sleep for a few milliseconds