-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore.h
33 lines (25 loc) · 979 Bytes
/
core.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* Titouan Teyssier, 10/14/2016 */
/* [email protected] */
#ifndef CORE_H
#define CORE_H
#include "structure.h"
// parameter of the Game Of Life
#define BIRTH 3
#define DEATH_INF 2
#define DEATH_SUP 3
/* game of life rules:
if a cell is alive AND she have less than 2 alive neighbor
OR
more than 3 alive neighbor
then she dies at the next generation respectively by under/over-population
else (if she is dead), if she have exactly 3 alive neighbor
then she became alive at the next generation.
*/
// function prototype
int nbNeighbor (t_cell mat[][N_COLUMN], int ligne, int colonne);
int nbNeighborBorderLess (t_cell mat[][N_COLUMN], int ligne, int colonne);
void fillNeighborMatrix (t_cell mat[][N_COLUMN], int neighbor[][N_COLUMN], int borderLess);
void nextGen (t_cell mat[][N_COLUMN], int neighbor[][N_COLUMN]);
void readMatrix (t_cell mat[][N_COLUMN]);
void initMatrix(t_cell mat[][N_COLUMN]);
#endif