IN101 project on Conway's Game of Life
Functions
naive_universe.c File Reference

Source file for a naive implementation of Conway's game of life universe structure. More...

#include "naive_universe.h"
Include dependency graph for naive_universe.c:

Functions

char naive_universe_get_cell (universe u, int row, int column)
 Get a cell from a universe. More...
 
void naive_universe_update_cell (universe u, int row, int column, char state)
 Update a given cell from a universe to a given state. More...
 
void print_naive_cells (universe u)
 Print a universe's cells state. More...
 
void print_naive_universe (universe u)
 Print a universe to the console. More...
 
void prettyprint_naive_universe (universe u)
 Pretty-prints a universe to the console. More...
 

Detailed Description

Source file for a naive implementation of Conway's game of life universe structure.

Author
Victor Colomb (vic.c.nosp@m.ol@h.nosp@m.otmai.nosp@m.l.fr)
Date
2021-02-23

Function Documentation

◆ naive_universe_get_cell()

char naive_universe_get_cell ( universe  u,
int  row,
int  column 
)

Get a cell from a universe.

Parameters
uuniverse
row
column
Precondition
row and column should be inferior respectively to the height and width of the universe.
Returns
. if the cell is dead and 0 if it is alive

◆ naive_universe_update_cell()

void naive_universe_update_cell ( universe  u,
int  row,
int  column,
char  state 
)

Update a given cell from a universe to a given state.

Parameters
uuniverse
row
column
statetrue for alive, false for dead

◆ prettyprint_naive_universe()

void prettyprint_naive_universe ( universe  u)

Pretty-prints a universe to the console.

The universe is formatted as follows:

Universe width: {width}
Universe height: {height}
Number of steps: {number of steps}
Universe cells state:
=====================
{universe cells}
Parameters
uuniverse

◆ print_naive_cells()

void print_naive_cells ( universe  u)

Print a universe's cells state.

Parameters
uuniverse

◆ print_naive_universe()

void print_naive_universe ( universe  u)

Print a universe to the console.

The universe is formatted as follows:

{width} {height}
{number of steps}
Array of cells, . representing a dead cell and 0 a live one.
Parameters
uuniverse