Skip to content

A real-time Conway's Game Of Life simulation in C, with simulation analytics.

License

Notifications You must be signed in to change notification settings

linguini1/C-onway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C-onway's Game of Life

Matteo Golin

A real-time Conway's Game of Life simulation written in C for high performance. Includes theme selection, speed controls, different cell types, real-time analytics, interactive simulation setup and more.

C-onway.mp4

Usage

Run the executable and interact with the live simulation windows with the controls.

Controls

  • Toggle pause/play with space.
  • Left click to toggle cells on the grid.
  • Press c to clear.
  • Press esc or q to quit.
  • Increase or decrease the simulation speed using the +/- keys.
    • Press m to increase to max speed.
  • Switch cell types using the number keys.
  • Zoom with the mouse wheel.
    • Use arrow keys to move around the zoomed in simulation grid.

Appearance:

  • Press t to cycle through themes.
  • Press d to toggle dark mode.
  • Press a to hide/show live analytics.

Building

Requires:

  • SDL2 library (2.0)
  • SDL_ttf library (2.20.2)

Building has currently only been tested on (Arch) Linux. Simply run make all to compile the entire program and link it with the SDL2 libraries.

On Windows, the same applies, but you will need to provide the paths to your SDL2 lib and include folders. The build command may look something like this:

make all \
SDL_INC=C:/path/to/SDL2/x86_64/include \
SDL_LINK=C:/path/to/SDL2/x86_64/lib
SDLTTF_INC=C:/path/to/SDL2_ttf/x86_64/include \
SDLTTF_LINK=C:/path/to/SDL2_ttf/x86_64/lib

Fonts

The default TTF font used for this program is included in the src/ directory. However, you may also provide your own TTF font if you prefer.

Compiling by hand, you must simply define FONT_PATH as the path to your desired TTF font:

gcc <cflags> -o main.o -c main.c -DFONT_PATH=/path/to/font.ttf

Compiling without FONT_PATH defined will provide a compile error. It is already defined with the default font for you if you are compiling with Make.

To change the path to something other than the default TTF font, you may call:

make all FONT_PATH=path/to/font

About

A real-time Conway's Game Of Life simulation in C, with simulation analytics.

Resources

License

Stars

Watchers

Forks

Packages

No packages published