IN101 project on Conway's Game of Life
|
Source code for a linked list implementation of Conway's game of life simulator. More...
#include "list_conway.h"
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... | |
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.
int list_count_neighbors | ( | universe | u, |
int | row, | ||
int | column, | ||
bool | consider_torus | ||
) |
Count alive neighbors of a cell in a given universe.
u | universe |
row | |
column | |
consider_torus | true to consider the universe as a torus |
linked_list list_neighbors | ( | universe | u, |
int | row, | ||
int | column, | ||
bool | consider_torus | ||
) |
Get a list of a cell's neighbors in a universe.
u | universe |
row | |
column | |
consider_torus | true to consider the universe as a torus |
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.
u | universe |
print_to_console | true to print each step to the console |
generate_images | true to generate images |
consider_torus | true to consider the universe as a torus |