Skip to content

Starting point for PHAS0100Assignment1 2021/22 Game of Life Simulation

License

Notifications You must be signed in to change notification settings

juanfrh7/PHAS0100Assignment1

Repository files navigation

PHAS0100ASSIGNMENT1

Build Status Build Status

Purpose

This project serves as a starting point for the PHAS0100 2021/22 Assignment 1 Game of Life Simulation coursework. It has a reasonable folder structure for CMake based projects, that use CTest to run unit tests via Catch.

This project aims at simualting Conway’s Game of Life, consisiting of 2D cellular automaton devised by the British mathematician John Conway in 1970. The rules of the game are very simple: 1) A live cell with two or three alive neighbours remains alive. 2) A dead cell with three live neighbours becomes a live cell. 3) All other live and dead cells die in the next generation.

In the DataStructure class we have build a simulation app that defines the game structure given a set of initial conditions. These conditions could be a filepath to a .txt file or the dimensions, number of alive cells and iterations. Moreover, in the gameEvolution class we have defined the rules necessary to evolve our system according to the rules defined above.

Finally, in the golBasicTest file we have defined a set of tests to check the correct functioning of the files. Here, we check for correct output and input types, ranges, dimensions, etc.

Credits

This project is maintained by Dr. Jim Dobson. It is based on CMakeCatch2 that was originally developed as a teaching aid for UCL's "Research Computing with C++" course developed by Dr. James Hetherington and Dr. Matt Clarkson.

Build Instructions

First, we need to build the build function and create the CMake files necessary to run the game. To do this, we have to make sure we are in the correct directory: this is PHAS0100Assignment1.Then, the following arguments should be given to the command line:

mkdir build
cd build
cmake ..
make

The game can be accessed by running the executable ./bin/gofSimulator and specifying the arguments through the command line. Specifically, what you can run is:

./bin/gofSimulator
./bin/gofSimulator --help (-h)
./bin/gofSimulator filepath iterations
./bin/gofSimulator rows columns cells
./bin/gofSimulator rows columns cells iterations

In order to check if the system evolves to a stationary pattern, we have build the stationaryPattern command line that prints the original and final stationaty pattern, if there is any. To check for patterns, you should run the executable ./bin/stationaryPatterns and specifying the arguments through the command line. Specifically, what you can run is:

./bin/stationaryPatterns
./bin/stationaryPatterns --help (-h)
./bin/stationaryPatterns rows columns cells iterations states  

In order to check that the tests are working, run ./bin/golBasicTest

Results

  • 7 by 7 grid with 15 alive cells after 6 iterations Image1
  • glider.txt grid after 4 iterations Image2
  • 4 by 4 grid with a maximum of 15 alive cells for 10 different configurations iterated 20 times each. The following are some examples of the patterns found
    Image3

About

Starting point for PHAS0100Assignment1 2021/22 Game of Life Simulation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages