Conway's Game of Life
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


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

  1. A live cell with fewer than 2 live neighbors dies, as if by under-population.
  2. A live cell with 2 or 3 live neighbors lives on.
  3. A live cell with more than 3 live neighbors dies, as if by over-crowding.
  4. A dead cell with exactly 3 live neighbors becomes a live cell, as if by reproduction.

TDD As If You Meant It

  1. Write implementation inside test method
  2. Extract implementation into either A. new methods within the test class or B. inside existing implementation methods
  3. Create implementation classes only as a destination for existing implementation methods
  4. Refactor as necessary
  5. Repeat!

Rules of Simple Design

  1. Tests pass
  2. No duplication (code > concepts > DRY)
  3. Reveals intent (good names)
  4. Small

Perfecting Small Classes and Short Methods

  1. Use only one level of indentation per method.
  2. Don’t use the ‘else’ keyword.
  3. Wrap all primitives and strings.
  4. Use only one dot per line.
  5. Don’t abbreviate names.
  6. Keep entities small.
  7. Don’t use any classes with more than two instance variables.
  8. Use first-class collections.
  9. Don’t use setters, getters, or properties.