Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (20 sloc) 752 Bytes

Conway's Game of Life

My take on core Conway's Game of Life implementation in different languages. This code may not be optimal or even correct.

Rules

  1. Live cell with fewer thatn two neighbours dies from starvation
  2. Live cell with two or three neighbours survives
  3. Live cell with more than three neighbours dies from overpopulation
  4. Dead cell with three neighbours becomes live (reproduction)

Example

3x3

Cell State Neighbours Next State Rule
1 Dead 2 Dead 4
2 Dead 3 Live 4
3 Live 1 Dead 1
4 Live 2 Live 2
5 Live 3 Live 2
6 Dead 3 Live 4
7 Dead 3 Live 4
8 Live 2 Live 2
9 Dead 2 Dead 4