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

Header file for an expandable 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_expandable.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_expandable (universe u, int row, int column)
 Get a list of a cell's neighbors in a universe. More...
 
int list_count_neighbors_expandable (universe u, int row, int column)
 Count alive neighbors of a cell in a given universe. More...
 
universe recenter_universe (universe u)
 Recenter a universe (move to all positive, increase height and width if needed) More...
 
universe list_step_expandable (universe u)
 Get a naive universe's next iteration.
Decrements the universe's step_nb parameter by one. More...
 
universe list_simulation_expandable (universe u, bool print_to_console, bool generate_images)
 Get the final state of a universe, according to its step_nb parameter. More...
 

Detailed Description

Header file for an expandable 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-16

Function Documentation

◆ list_count_neighbors_expandable()

int list_count_neighbors_expandable ( universe  u,
int  row,
int  column 
)

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_expandable()

linked_list list_neighbors_expandable ( universe  u,
int  row,
int  column 
)

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_expandable()

universe list_simulation_expandable ( universe  u,
bool  print_to_console,
bool  generate_images 
)

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_expandable()

universe list_step_expandable ( universe  u)

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

◆ recenter_universe()

universe recenter_universe ( universe  u)

Recenter a universe (move to all positive, increase height and width if needed)

Parameters
uuniverse
Returns
recentered universe