gbrivady / IN101-Project

Lil backup of the IN101 Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IN101 mini project.

This project is an implementation of Conway's Game of Life.
There are two differents implementation : the first one represents the universe as
a grid of character, and will be called the naive implementation.
The second one uses linked list to represent only the living cells of the universe,
and will be called the list implementation.

This project allows to load the initial configuration of the universe from a text file,
and produces a list of images corresponding to each step of the simulation.

In the naive implementation, the universe is assumed to be a torus.
In the list implementation, the universe expands as cells get past its boundaries.

/* Creating a universe */

The initial configuration of the universe must be stored in a text file,
following this format :
 - the universe must be a rectangle
 - the first line of the file contains the height and the width of the universe, separated by a space
 - the second line of the file contains the number of simulation steps
 - alive cells are represented by the character 'o'
 - empty cells are represented by the character '.'

The data folder contains examples.

/* Launching a naive simulation */

To create the executable for the application, use :

make app-naive-conway

To run the simulation with the initial configuration filepath/your_file.txt use the command:

./app-naive-conway filepath/your_file.txt

Example : the command "./app-naive-conway ./data/glider.txt" will run 10 steps of the simulation
with a 21x20 universe containing only a single glider on the top-left corner.

/* Launching a list simulation */

To create the executable for the application, use :

make app-list-conway

To run the simulation with the initial configuration filepath/your_file.txt use the command:

./app-list-conway filepath/your_file.txt

Example : the command "./app-list-conway ./data/glider.txt" will run 10 steps of the simulation
with a 21x20 universe containing only a single glider on the top-left corner.

/* Image output */

Images are stored in the out folder. They are PPM images following this format :

 - a black pixel represents an empty cell
 - a white pixel represents a living cell
 - img-XXX.ppm represents the XXXth step of the simulation, with XXX = 000 being the initial configuration.

It is possible to produce a video.mp4 video file from the images generated by using the command :

make video

The video will be on the root folder.

To delete the video and the images, use the command:

make clean-img

About

Lil backup of the IN101 Project


Languages

Language:TeX 70.9%Language:C 26.0%Language:Makefile 3.0%