Author: Jack Robbins
John Conway's Game of Life is perhaps the most famous "0 Player Game" ever made. Conway's Game of Life's evolution is entirely determined by its initial state, and it is impossible to predict what a certain pattern will do without running the actual pattern. Each "generation" of the game is a grid of cells, often called Cellular Automata, that interact with eachother via a determined set of rules that will dictate if a given cell lives or dies.
The rules of the game are very simple, and are as follows:
- Any living cell with less than 2 live neighbors dies
- Any living cell with 2 or 3 live neighbors survives to the next generation
- Any living cell with more than 3 neighbors dies
- Any dead cell with exactly 3 live neighbors comes to life
With these simple rules, a game board can come to life with as long as there is a given seed. The board will continue to evolve forever, or die out completely. Whatever the outcome is, it is impossible to tell without letting the game run out to infinity. The Game of Life is truly fascinating to me and I intend to do more with it in the future. This program is just a fun proof of concept to get the basics working using ncurses in the terminal.
To run this program, first clone the repository and navigate to the directory that it downloaded under. For your convenience, a runner script has been provided for compiling/running the program. All you must do is run the following commands:
example@bash: ~/Game-of-Life $ chmod +x run.sh
example@bash: ~/Game-of-Life $ ./run.sh
It is important to note that upon running the final command, your screen will enter 'ncurses
' mode, meaning that there is no typing or exit ability. The program will first display the welcome screen shown above, or this welcome screen if your terminal window is too small:
After the welcome screen shows the <Press any key to begin>
command, hitting any key will immediately launch the game, at which point you'll immediately begin seeing the Game of Life play out in front of you like this:
In order to quit the game, you must press 'q
', which will immediately kill the program and take you to an exit screen.
If this is something that you are interested in, I would greatly encourage you to download the program and take it for a spin. It is very simple in its current iteration, but this also has the benefit of making it extremely lightweight, being written in pure C, and easy to understand. My future ideas for this program include adding the ability for the user to create their own random seed for the board, as well as integrating patterns like Gliders and Gosper Guns. Hopefully, I'll have some free time to get around to it. Enjoy the Game of Life!