I recently attended a Global Day of Coderetreat in Salford. I was part of a delegation from the company where I work, DRL, which also co-sponsored the event.
The event involved pair programming and TDD. Each of the six pairings throughout the day lasted 45 minutes. The exercise for the day was Conway's Game of Life.
During the week after the event, I decided to come up with a complete implementation of the exercise including rendering to the console. This project is the result.
The first command line parameter identifies which seed pattern to use:
- 1 - Blinker
- 2 - Toad
- 3 - Beacon
- 4 - Pulsar
- 5 - Glider
- 6 - Lightweight space ship
- 7 - R-pentomino
- 8 - Gun
If no parameter is given, the seed defaults to Pulsar.
The optional second parameter controls the sleep interval between ticks. It defaults to 100ms.
- Conway's Game of Life
- Manchester Code Retreat 8th December 2012
- Global Day of Coderetreat
- DRL Limited
- DRL's main website - www.appliancesonline.co.uk
The following screenshot shows the R-pentomino seed after it has stabilised:
The following screenshot shows the Gun seed in action:
I have added support for zombies i.e. cells that have been alive and then died and then come back to life again. Zombie cells are displyed in magenta. Normal live cells are displayed in cyan. Here is an updated screenshot of the R-pentomino seed showing some zombie cells.