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

Source code for a linked list implementation of Conway's game of life simulator. More...

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

Functions

linked_list list_neighbors (universe u, int row, int column, bool consider_torus)
 Get a list of a cell's neighbors in a universe. More...
 
int list_count_neighbors (universe u, int row, int column, bool consider_torus)
 Count alive neighbors of a cell in a given universe. More...
 
universe list_step (universe u, bool consider_torus)
 Get a naive universe's next iteration.
Decrements the universe's step_nb parameter by one. More...
 
universe list_simulation (universe u, bool print_to_console, bool generate_images, bool consider_torus)
 Get the final state of a universe, according to its step_nb parameter. More...
 

Detailed Description

Source code for a linked list implementation of Conway's game of life simulator.

Source code for an expandable linked list implementation of Conway's game of life simulator.

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

Function Documentation

◆ list_count_neighbors()

int list_count_neighbors ( universe  u,
int  row,
int  column,
bool  consider_torus 
)

Count alive neighbors of a cell in a given universe.

Parameters
uuniverse
row
column
consider_torustrue to consider the universe as a torus
Returns
number of alive neighbors of the given cell

◆ list_neighbors()

linked_list list_neighbors ( universe  u,
int  row,
int  column,
bool  consider_torus 
)

Get a list of a cell's neighbors in a universe.

Parameters
uuniverse
row
column
consider_torustrue to consider the universe as a torus
Returns
linked_list of neighbors

◆ list_simulation()

universe list_simulation ( universe  u,
bool  print_to_console,
bool  generate_images,
bool  consider_torus 
)

Get the final state of a universe, according to its step_nb parameter.

Parameters
uuniverse
print_to_consoletrue to print each step to the console
generate_imagestrue to generate images
consider_torustrue to consider the universe as a torus
Returns
the universe's final state

◆ list_step()

universe list_step ( universe  u,
bool  consider_torus 
)

Get a naive universe's next iteration.
Decrements the universe's step_nb parameter by one.

Parameters
uuniverse
consider_torustrue to consider the universe as a torus
Returns
the given universe's next iteration