JaumeAlbardaner / gameOfLife

Code for the realization of the Game of Life project for the Embedded & RT Systems course @ MUAR

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Game of Life

In this repository, we include the code necessary to run the game of life specified in the Embedded & Real Time Systems course taught at the MS in Automatic Control and Robotics @ UPC.

Contents

  1. Rules
  2. How to run
  3. Troubleshooting

1. Rules

  • Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  • Any live cell with two or three live neighbours lives on to the next generation
  • Any live cell with more than three live neighbours dies, as if by over-population.
  • Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

Series of patterns

Because of the rules specified previously, different structures get generated. They are categorized into three main groups depending if they are static(still lifes), if they don't move but change pattern (oscillators), and the last ones are those that move (spaceships).

Still Lives Oscillators Spaceships
Block block gif Blinker (period 2) block gif Glider block gif
Bee-hive Beehive gif Toad (period 2) Toad gif Light-weight spaceship (LWSS) LWSS gif
Loaf Loaf gif Beacon (period 2) Beacon gif Middle-weight spaceship (MWSS) MWSS gif
Boat Boat gif Pulsar (period 3) Pulsar gif Heavy-weight spaceship (HWSS) HWSS gif
Tub Tub gif Penta-decathlon (Period 15) Penta-decathlon gif

2. How to run

Start by git cloning this repository locally:

mkdir -p ~/git && cd ~/git
git clone https://github.com/JaumeAlbardaner/gameOfLife.git

Compile the C code:

cd ~/git/gameOfLife && make

Run it 🎉

cd ~/git/gameOfLife && ./main

Once you run it, you may select the dimensions of the world as well as what structure you want to simulate from:

Name Command # Preview
The R-Pentomino 1 block gif
Diehard 2 block gif
Acorn 3 block gif
Random else -

3. Troubleshooting

  • The only issue that has been found is that requesting a large grid size may result in the Game of Life not appearing in its entirety on the screen.

    Fix Set a smaller size for the board, or try rerunning the game (maybe it was just a bad unlucky initialization).

About

Code for the realization of the Game of Life project for the Embedded & RT Systems course @ MUAR


Languages

Language:C 85.4%Language:Makefile 14.6%