Visualization of Conway's Game of Life and other life-like cellular automata using SFML.
Conway's Game is a cellular automata invented by the British mathematician John Horton Conway in 1970. It is a zero-player game that evolves based on its initial state. Cells in a grid live, die, or multiply based on the following rules:
- Any live cell with fewer than two living neighbors dies (underpopulation).
- Any live cell with two or three living neighbors lives on to the next generation.
- Any live cell with more than three living neighbors dies (overpopulation).
- Any dead cell with exactly three living neighbors becomes a living cell (reproduction).
Other Cellular automata are considered Life-like, when they present a similar behaviour to Conway's Game of Life and meet the following criteria:
- The array of cells of the automaton has two dimensions.
- Each cell of the automaton has two states.
- The neighborhood of each cell is the Moore neighborhood.
- In each time step of the automaton, the new state of a cell can be expressed as a function of the number of adjacent cells that are in the alive state and of the cell's own state. There are in total 2^18 possible life-like rules that can be studied.
- C++17 compiler.
- CMake 3.22.0.
- SFML 2.6.1 requirements.
- Add/Remove Cells [Mouse Left].
- Load/Save Patterns [L/S].
Pattern files are stored in folder /patterns using Run Length Encoded format. Example of pattern files can be found at https://conwaylife.com/wiki. - Populate [P].
Fill the grid with a random pattern of living cells. - Rule.
Set birth/survival rules in Golly/RLE format . - Reset [R].
Reset active pattern to its initial configuration. - Clear Grid [G].
- Set Zoom Level [Mouse Wheel].
- Drag View [Mouse Right].
- Clone the repository to your local machine.
git clone https://github.com/alejandrofsevilla/game-of-life.git cd game-of-life
- Build.
cmake -S . -B build cmake --build build
- Portable installation.
cmake --install build