Skip to content

This is an implementation of the famous Game of Life cellular automaton in C++ with several simulation options using the olcConsoleGameEngine

Notifications You must be signed in to change notification settings

howlettjames/Game-Of-Life

Repository files navigation

Game Of Life

This is an implementation of the famous Game of Life cellular automaton in C++ using the olcConsoleGameEngine. Check usage and results of this work here.

Tech Stack

Summary

This implementation provides several simulation options as:

  • Choosing the rules by which the GOL will simulate, the default one is B3/S23

  • The ability load a pre configuration file i.e. a file containing an already simulated state of the automata.

  • The ability to choose the percentage of live cells at the beginning of the simulation.

  • There are two types of Pattern Recognition inside the simulation to choose:

    • Oscilators-Still-Chaos: This will represent the Oscilating life forms, Still lifes and 'Chaos' (any other) in different colors.

    • Static-NonStatic: This will only show two different kind of cells, those who stay still over more than one generation and those who not.

  • The ability to slow down the simulation by maintaining the function keys pressed:

    • F1 delays for 100ms.
    • F2 delays for 200ms.
    • F3 delays for 300ms.
    • F5 delays for 500ms.
    • F10 delays for 1s.
    • F11 delays for 2s.
  • Finally, it is also posible to stop the simulation at any generation using the Esc key, then you will be asked if a configuration file with the actual generation should be saved or exit otherwise.

It also does a computation of several variables over each generation:

  • Average cell life forms.
  • Shannon Entropy calculation.
  • Variance
  • Number of Oscilators, Still or Chaos forms.

Run the program

In order to run the program you need to:

  • Download the code.
  • Run in a Linux distribution (Ubuntu recommended).
  • Having SDL2 and C++ installed on your computer.
  • Compile with:
g++ game.cpp -DUNICODE -I/usr/include/SDL2 -lSDL2 -lpthread -std=c++11 -o game.out
  • Run:
./game.out

Example of a simulation with rule B3/S23

Running the simulation

About

This is an implementation of the famous Game of Life cellular automaton in C++ with several simulation options using the olcConsoleGameEngine

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages