Word Count: 191
One day I was bored and found myself on wikipedia reading about Conway’s Game of Life and decided I wanted to implement it.
The rules
- Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.
- Any live cell with two or three live neighbours lives on to the next generation.
- Any live cell with more than three live neighbours dies, as if by overpopulation.
- Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
The not-rules
So, I spent an hour or two with the initial implementation:
- Written in Golang.
- Console based.
- Uses nsf’s termbox-go for a lot of the console heavy lifting.
Then spent some more time adding in some enhancements:
- Right click
- Horizontal row state is toggled.
- Left click
- Vertical row state is toggled.
- Middle click
- That single cell’s state is toggled.
- Up arrow
- Increase # of generations per render
- Down arrow
- Decrease # of generations per render
This would allow certain states that were stable to become unstable for a while and introduce some dynamicness into the “game”.
When it was all put together, I got this: