Repos

Game of life

This is a simple implementation of John Conway’s Game Of Life! It’s made in C and it’s using the great Raylib graphics library. The game is a cellular automaton which roughly means that we create some cells and let them evolve by simply following some rules.

Rules

The game evolution is determined by simple rules applied on each cells.

  1. Any live cell with fewer than 2 live Neighbors dies. Underpopulation
  2. Any live cell with more than three live neighbours dies Overpopulation
  3. Any dead cell with 3 neighbors respawns Reproduction
  4. Any live cell with 2 or 3 live neighbors lives Normal life

Demos

C version

To run it, you’ll need the Raylib library installed. HOW TO

Download, Compile and run the program:

git clone git@github.com:ThePurpleOne/life.git
make run

Random game

Fun patern that appeared (a lot more on the wikipedia page)

Go 3D version

Download, Compile and run the program:

git clone git@github.com:ThePurpleOne/3d_life.git

Rust version

git clone git@github.com:ThePurpleOne/rife.git 
cd rife
cargo run

Demo

/life/life1.gif /life/spawn_glider.gif

Try it

You’ll need to download Cmake https://cmake.org/download/ for raylib to work

Then just:

git clone git@github.com:ThePurpleOne/rife.git 
cd rife
cargo run

Poor performances

Run the profiling:

perf record ./target/release/life
perf report

/life/profiling_1.png

Todos

Lot of Optimizing:

  • double buffering
  • threading computing by line or by chunk.

Features:

  • Spawn cells with mouse
  • Spawn shapes
  • Sliders for tweaking setting live

Clean:

  • Clean up code

Sources

Wikipedia

Video - Coding Train

Raylib - Graphics Library

Rust