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

Header file for a linked list implementation of Conway's game of life simulation. More...

#include <stdbool.h>
#include "list_universe.h"
#include "list_pbm_writer.h"
Include dependency graph for list_conway.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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

Header file for a linked list implementation of Conway's game of life simulation.

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