- Note: GIF with 10fps (not accurate to real simulation in terminal)
The universe of the Game of Life is an infinite, two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, live or dead (or populated and unpopulated, respectively). Every cell interacts with its eight neighbors, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:
Read more here: https://en.wikipedia.org/wiki/Conway's_Game_of_Life
- Any live cell with fewer than two live neighbours dies, as if 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.
Initial state is random (you can choose probability for: cell alive)
- C compiler (gcc or clang, or everything that compiles C code)
- Ncurses libary (retro 1990's C libary for terminal plotting)
sudo apt update
sudo apt install libncurses-dev
brew install ncurses
- Press q to quit
- Press 'space' to start or pause the simulation
- Press r to create random cells
gcc -c simulation.c
gcc -c main.c
gcc -o main simulation.o run.o -lncurses
./main
