https://github.com/filippopaganelli/c-gol-raylib
Interactive Game of Life Implementation in C using Raylib.
https://github.com/filippopaganelli/c-gol-raylib
c cgraphics gameoflife raylib
Last synced: 2 months ago
JSON representation
Interactive Game of Life Implementation in C using Raylib.
- Host: GitHub
- URL: https://github.com/filippopaganelli/c-gol-raylib
- Owner: FilippoPaganelli
- License: mit
- Created: 2024-10-01T20:06:42.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-25T22:56:40.000Z (7 months ago)
- Last Synced: 2024-10-26T06:41:23.935Z (7 months ago)
- Topics: c, cgraphics, gameoflife, raylib
- Language: C
- Homepage:
- Size: 920 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Interactive Game of Life Implementation in C using Raylib.
This is an implementation of [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) written in C, using [Raylib](https://www.raylib.com/) for the graphics.
The canvas is initialised with a simple [Glider](https://conwaylife.com/wiki/Glider), or with a saved state from the file argument.### TODO:
- [x] Load state from file
- [x] Save state to file
- [x] Show events notification (e.g. on file save or error)
- [x] Add key command to randomly generate a state
- [ ] Allow mouse dragging in DRAW mode (?)### Compile and Run:
```console
make
./gol ["state.gol"]
```Before compiling, install [Raylib](https://www.raylib.com/).
### Controls:
- (d): enter DRAW mode and use mouse to spawn/kill cells on the canvas
- (SPACE): save current state in a checkpoint and PLAY/PAUSE the simulation
- (w): REWIND to the state saved in the checkpoint
- (r): RESET to an empty canvas
- (R): populate the canvas with a random state
- (S): SAVE the current state to a file (`state.gol`) to load it in a future session### Video demo:
https://github.com/user-attachments/assets/49c6b381-5d6d-41de-be87-2e272576a6e5