This program is a simulation for Conway's Game of Life in C using SDL3 for the graphical interface.
It has a theoretically infinite grid by using a sparse encoding method as javidx9 described in his video:
Call ./gol or ./gol-static depending on the version you have.
Please note you may need to allow the execution of either file for this to work.
By default, the window will have a 500x500 square randomly filled by around 7%.
You can change the size of the starting square by specifying two arguments, like so: ./gol WIDTH HEIGHT.
Another way to launch is to load patterns using the RLE format as described here.
Note
There are example patterns in the patterns folder of this current repository.
Warning
You can find more patterns at Game of Life Wiki Please note however that you need to comment all lines starting with something like x = ... or title=.... Otherwise you will probably get strange results.
When you have your pattern, call ./gol path/to/pattern.rle to simulate.
If you want to add an offset for the pattern, either positive or negative, add it after the pattern's path: ./gol path/to/pattern.rle OFFSET_X OFFSET_Y
By default, the simulation doesn't start by itself.
So you need to start it manually using either of these 2 methods:
- Press
Spaceand the simulation will run every frame, or at least as fast as it can. If you pressSpaceagain, the program will pause the simulation until you pressSpaceagain. - Press
Sand the simulation will iterate once.
If you want to stop, press Escape or the close the window.
You can resize the window even when paused and it will render the current state.
