Conway's Game of Life as a terminal screensaver in C++ and ncurses, with a toroidal grid, custom glyphs, colors, rainbow mode and auto-restart.
C++
0
14 commits
updated Oct 5, 2026
Conway's Game of Life as a terminal screensaver, written in C++ with ncurses.

cppautomata

cppautomata -r -t 00:10:00 ●

cppautomata 🐉
man cppautomatag++)makencursesw), needed for Unicode glyphs| Distribution | Command |
|---|---|
| Fedora | sudo dnf install gcc-c++ make ncurses-devel |
| Debian / Ubuntu | sudo apt install g++ make libncurses-dev |
| Arch | sudo pacman -S gcc make ncurses |
| macOS (untested) | brew install ncurses |
git clone https://github.com/Riccardo-Martelli/cppautomata.git
cd cppautomata
make
This compiles the program and installs the binary to ~/.local/bin and the man page to ~/.local/share/man/man1. Then run it from anywhere:
cppautomata
man cppautomata
If the shell says command not found, ~/.local/bin is not in your PATH. Add it:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Other targets:
| Command | Effect |
|---|---|
sudo make PREFIX=/usr/local | install for all users |
make uninstall | remove the binary and the man page |
make clean | delete the compiled binary from the repository folder |
cppautomata [options] [glyph]
--version show cppautomata version and exit
-c COLOR foreground color of live cells (default: red)
-b COLOR background color (default: black)
-v MS milliseconds between generations, integer > 0 (default: 100)
-s N restart every N generations, 0 = never (default: 0)
-t HH:MM:SS restart after this much run time (default: never)
-m MODE initial pattern: random, glider, blinker (default: random)
-r rainbow mode: change the foreground color at every generation
-h show help and exit
colors:
black, red, green, yellow, blue, magenta, cyan, white
glyph is the string drawn for each live cell. The default is a full block █.
| Key | Action |
|---|---|
q | quit |
r | restart from the initial pattern |
c | next foreground color |
b | next background color |
cppautomata # default: random start, red blocks on black
cppautomata -c green -v 50 -s 500 # faster, restarts every 500 generations
cppautomata -m glider -c cyan o # a single glider drawn with the letter o
cppautomata -r -t 00:10:00 ● # rainbow dots, restart every 10 minutes
cppautomata 🐉 # dragons
Each generation is computed on a fresh copy of the grid, so every cell sees the previous state of its neighbours. A cell counts its eight neighbours, with the indices wrapped around the edges so the board is a torus, and the standard rules apply:
| Current state | Live neighbours | Next state |
|---|---|---|
| alive | fewer than 2 | dies |
| alive | 2 or 3 | survives |
| alive | more than 3 | dies |
| dead | exactly 3 | becomes alive |
The new grid is then drawn cell by cell with ncurses and the program sleeps for the interval set by -v.
-t timer counts the sleep intervals, not wall clock time, so on large grids the real time before a restart is slightly longer.MIT, see LICENSE.
Conway's Game of Life as a terminal screensaver in C++ and ncurses, with a toroidal grid, custom glyphs, colors, rainbow mode and auto-restart.
C++
0
14 commits
updated Oct 5, 2026
Conway's Game of Life as a terminal screensaver, written in C++ with ncurses.

cppautomata

cppautomata -r -t 00:10:00 ●

cppautomata 🐉
man cppautomatag++)makencursesw), needed for Unicode glyphs| Distribution | Command |
|---|---|
| Fedora | sudo dnf install gcc-c++ make ncurses-devel |
| Debian / Ubuntu | sudo apt install g++ make libncurses-dev |
| Arch | sudo pacman -S gcc make ncurses |
| macOS (untested) | brew install ncurses |
git clone https://github.com/Riccardo-Martelli/cppautomata.git
cd cppautomata
make
This compiles the program and installs the binary to ~/.local/bin and the man page to ~/.local/share/man/man1. Then run it from anywhere:
cppautomata
man cppautomata
If the shell says command not found, ~/.local/bin is not in your PATH. Add it:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Other targets:
| Command | Effect |
|---|---|
sudo make PREFIX=/usr/local | install for all users |
make uninstall | remove the binary and the man page |
make clean | delete the compiled binary from the repository folder |
cppautomata [options] [glyph]
--version show cppautomata version and exit
-c COLOR foreground color of live cells (default: red)
-b COLOR background color (default: black)
-v MS milliseconds between generations, integer > 0 (default: 100)
-s N restart every N generations, 0 = never (default: 0)
-t HH:MM:SS restart after this much run time (default: never)
-m MODE initial pattern: random, glider, blinker (default: random)
-r rainbow mode: change the foreground color at every generation
-h show help and exit
colors:
black, red, green, yellow, blue, magenta, cyan, white
glyph is the string drawn for each live cell. The default is a full block █.
| Key | Action |
|---|---|
q | quit |
r | restart from the initial pattern |
c | next foreground color |
b | next background color |
cppautomata # default: random start, red blocks on black
cppautomata -c green -v 50 -s 500 # faster, restarts every 500 generations
cppautomata -m glider -c cyan o # a single glider drawn with the letter o
cppautomata -r -t 00:10:00 ● # rainbow dots, restart every 10 minutes
cppautomata 🐉 # dragons
Each generation is computed on a fresh copy of the grid, so every cell sees the previous state of its neighbours. A cell counts its eight neighbours, with the indices wrapped around the edges so the board is a torus, and the standard rules apply:
| Current state | Live neighbours | Next state |
|---|---|---|
| alive | fewer than 2 | dies |
| alive | 2 or 3 | survives |
| alive | more than 3 | dies |
| dead | exactly 3 | becomes alive |
The new grid is then drawn cell by cell with ncurses and the program sleeps for the interval set by -v.
-t timer counts the sleep intervals, not wall clock time, so on large grids the real time before a restart is slightly longer.MIT, see LICENSE.