Conway's Game of Life in python.
The Game of Life, is a zero-player game first conceived by John Horton Conway in 1970. The game is played in a 2d grid. Each gridpoint represents a live or dead cell. On each generation, the following rules are applied.
- Any live cell with fewer than two live neighbours dies.
- 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.
- Any dead cell with exactly three live neighbours becomes a live cell.
For more info, visit https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life#References
The game is implemented using an object oriented approach and the Python programming language. The code consists of 3 files.
- life_source.py : The bulk of the code, contains the Life class which implements the game.
- utils.py : Utilities like initial seed reshape function, periodic BC index managment, some initial seeds , etc.
- run.py : The runfile of the program. The parameters are self explainatory.
Note that, as of now, the simulation grid is using periodic boundary conditions.
All classes, methods and functions have been thouroughly documented in the form of docstrings.
Below are some examplary animations created by the code for various initial seeds.