|
IN101 project on Conway's Game of Life
|
Header file for a naive implementation of Conway's game of life simulation. More...
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdbool.h>#include "naive_universe.h"#include "naive_pbm_writer.h"

Go to the source code of this file.
Functions | |
| int | naive_count_neighbors (universe u, int row, int column, bool consider_torus) |
| Count alive neighbors of a cell in a given universe. More... | |
| universe | naive_step (universe u, bool consider_torus) |
| Get a naive universe's next iteration. Decrements the universe's step_nb parameter by one. More... | |
| universe | naive_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... | |
Header file for a naive implementation of Conway's game of life simulation.
Naive implementation of the Conway's game of life:
The universe's size if given and constant.
The universe state is recorded using a character list (string) following the convention . for dead and o for alive.
Stepper works the following way:
API
naive_step to get a universe's next stepnaive_simulation to get a universe's final step and optionally print to console and generate images | int naive_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 |
| universe naive_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 |
1.8.13