Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dakizu/conway
A simple ANSI C implementation of Conway's Game of Life
https://github.com/dakizu/conway
ansi-c c89 console conway conways-game-of-life sdl2
Last synced: 21 days ago
JSON representation
A simple ANSI C implementation of Conway's Game of Life
- Host: GitHub
- URL: https://github.com/dakizu/conway
- Owner: dakizu
- License: mit
- Created: 2021-09-09T17:14:23.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-14T04:03:46.000Z (over 3 years ago)
- Last Synced: 2024-10-25T22:31:02.969Z (2 months ago)
- Topics: ansi-c, c89, console, conway, conways-game-of-life, sdl2
- Language: C
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Conway's Game of Life
This is a simple implementation of Conway's Game of Life written in C89 (ANSI C).### Build
The makefile has two targets: **console** and **pixel**.To build one of the targets, simply run `make console` or `make pixel`.
The **console** target simply defines CONWAY_CONSOLE and compiles conway.c.
This option requires no dependencies and displays the output of the program through printf().
Press the enter key to progress the simulation, and press Ctrl+C to exit.The **pixel** target defines CONWAY_PIXEL and compiles conway.c as well as pixel.c.
This option requires SDL2 as a dependency and displays the output of the program through a graphical window.
Press any key on your keyboard to progress the simulation and click on the screen to set any cell at runtime.### Files
Aside from the Makefile, README.md, and LICENSE files, this repository contains three source files: `conway.c`, `pixel.h`, and `pixel.c`.`conway.c` contains the entire implementation of Conway's Game of Life as well as the abstracted rendering code for both of
the targets (hidden behind **CONWAY_CONSOLE** and **CONWAY_PIXEL** ifdefs respectively).`pixel.h` contains the API for the pixel renderer used in the **pixel** target. This api is completely decoupled from SDL2 as I might
go back and implement more backends later as a learning exercise.`pixel.c` contains the SDL2 implementation of the pixel renderer.