Skip to content

Latest commit

 

History

History
81 lines (53 loc) · 3.74 KB

File metadata and controls

81 lines (53 loc) · 3.74 KB

Cell Simulator

C application based on Conway's Game of Life. It simulates cellular life based on specific rules.

  1. Any live cell with fewer than two live neighbours dies, as if by underpopulation.
  2. Any live cell with two or three live neighbours lives on to the next generation.
  3. Any live cell with more than three live neighbours dies, as if by overpopulation.
  4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

With these simple four rules, you can create interesting patterns and observe how they evolve over generations. Below is an example:

gif_first

Cell Simulator uses Raylib for the graphical user interface (GUI).

Installation

There are two ways to install Cell Simulator.

Option 1: Get it from the Releases page

  1. Go to releases page.
  2. Download cell_simulator.rar.
  3. Extract cell_simulator.rar.
  4. Run life_simulator.exe.
  5. Enjoy.

Note: If Windows Defender flags the downloaded file as a threat, please rest assured it’s a false positive. You can exclude the file temporarily or verify it with VirusTotal. Below is a screen capture of VirusTotal after scanning my own life_simulator.exe.

image

But if by any means you don't feel comfortable with this executable, proceed to the 2nd option below.

Option 2: Compile it by yourself

In order to compile Cell Simulator, you need w64devkit with raylib's libraries configured. If you don't already have these, follow the steps below.

  1. Install w64devkit.
  2. Download raylib-x.x_win64_mingw-w64.zip from https://github.com/raysan5/raylib/releases.
  3. Extract raylib-x.x_win64_mingw-w64.zip.
  4. Copy the include and lib folders into C:\w64devkit\x86_64-w64-mingw32
  5. Run w64devkit.exe from C:\w64devkit\

Compilation steps using w64devkit

  1. Clone this repository:
git clone https://github.com/ulises-justo-saucedo/cell-simulator
  1. Navigate to cell-simulator/src folder and compile it using gcc:
cd cell-simulator/src
gcc main.c life_simulator.c -lraylib -lgdi32 -lwinmm -o life_simulator

⚠️ Warning: Note that I use -lwinmm flag since I'm in Windows Operative System.

Features

  1. Real time simulation of cellular life.
  2. Keys for pausing, restarting and randomizing simulation.
  3. Mouse interactions for manipulating cells directly.

Controls

  1. Spacebar: Pauses simulation.

gif_spacebar_example

  1. C key: Clears the simulation by killing all cells.

gif_clear_example

  1. R key: Randomices the entire board.

gif_randomoce_example

  1. Mouse left button: Kills or spawns a single hovered cell.

gif_mouseleftbutton_example

  1. Mouse right button: Kills or spawns multiple hovered cells by dragging mouse.

gif_mouserightbutton_example