Skip to content

8dcc/game-of-life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game of life

Conway's game of life made in C using sdl2.

Forks Stars

Note
This project is old and the code sucks. I am going to improve it in the future.
If you are interested in other projects I made with better code, check this.

Table of contents

  1. Keys
  2. Configuration
  3. Misc
  4. TODO

Keys

Key Action
Esc Exit.
LMouse Change the cell's state individually.
RMouse Change the cell's state (drag).
Space Hold to start the game of life simulation.
H Show help in console.
G Togge grid.
S Save current state.
L Load saved state.
C Clear (Set state of all cells to 0).
R Random state.

Configuration

Name Description
WINDOW_H Window height in pixels.
WINDOW_W Window width in pixels.
CELL_SIZE Cell size in pixels.
BACKGROUND_COLOR Will be used as RGB value for the background.
For example 34 = RGB(34, 34, 34) = #222222.
CELL_COLOR Will be used as RGB value for the living cells.
GRID_COLOR Will be used as RGB value for the grid.
FPS In ms. The program will wait 1000/FPS (1000 / 60 = 16ms between frames).
DELAY If the space is pressed the delay between frames will be switched to this.
(Instead of 16ms for example).
DEBUG_PRINT If 0, the program will print information about keypresses and cell interactions.

Misc

TODO

  • Make saves independent on the array size (resolution)