Conway's Game of Life
As practiced at Code Retreats worldwide!
An infinite grid of cells. Cells are either live or dead. At every game "turn", evaluate the next generation of live and dead cells
- A live cell with fewer than 2 live neighbors dies, as if by under-population.
- A live cell with 2 or 3 live neighbors lives on.
- A live cell with more than 3 live neighbors dies, as if by over-crowding.
- A dead cell with exactly 3 live neighbors becomes a live cell, as if by reproduction.
- Write implementation inside test method
- Extract implementation into either A. new methods within the test class or B. inside existing implementation methods
- Create implementation classes only as a destination for existing implementation methods
- Refactor as necessary
- Tests pass
- No duplication (code > concepts > DRY)
- Reveals intent (good names)
- Use only one level of indentation per method.
- Don’t use the ‘else’ keyword.
- Wrap all primitives and strings.
- Use only one dot per line.
- Don’t abbreviate names.
- Keep entities small.
- Don’t use any classes with more than two instance variables.
- Use first-class collections.
- Don’t use setters, getters, or properties.