main
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include "cell.h"
5
6Cell* cell_create(int number_of_cells) {
7 Cell *cells = malloc(sizeof(Cell) * number_of_cells);
8 memset(cells, 0, sizeof(Cell) * number_of_cells);
9
10 for (int i = 0; i < number_of_cells; i++) {
11 cells[sizeof(Cell) * i].alive = false;
12 /*cells[sizeof(Cell) * i].index = i;*/
13 }
14 return cells;
15}
16
17int cell_alive(Cell *cell) {
18 return cell->alive ? 1 : 0;
19};
20
21void cell_change_life(Cell *cell, bool alive) {
22 cell->alive = alive;
23}
24
25void cell_print(Cell *cell) {
26 printf("%s", cell->alive ? "O" : " ");
27}