CellViz  1.0
cellviz.h
Go to the documentation of this file.
1 //
2 // Created by velocitatem on 9/27/24.
3 //
4 #include <iostream>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <vector>
8 
9 #include "board.h"
10 #include "cells.h"
11 
12 
13 using namespace std;
15 {
16  // nxn board of TYPE for SIZE
17  Board board(size, size, GRID, 3);
18  double ** data;
19 
20 
21  // populate board
22  string species = "x";
23  for (int i = 0 ; i < size; i++) {
24  int x = rand() % 100;
25  SmithLife *cell = new SmithLife(i, i, x);
26  board.add_cell(cell);
27  }
28  CellularAutomaton * c = board.get_cell(1,1);
29 
30 
31  return board;
32 
33  int MAX_IT = size, i = 0;
34  while (i < MAX_IT) {
35  // UPDATE DATA
36  SmithLife::compute(board);
37  //board = new_board;
38  // RENDER
39  if (i == MAX_IT-1)
40  board.render();
41 
42  i+=1;
43  }
44  return board;
45 }
@ GRID
Definition: board.h:17
Board initialise_board(int size)
Definition: cellviz.h:14
Definition: board.h:21
CellularAutomaton * get_cell(int x, int y) const
Definition: board.cpp:130
void render()
Definition: board.cpp:140
void add_cell(CellularAutomaton *cell)
Definition: board.cpp:74
Definition: cells.h:18
Represents a type of cellular automaton called SmithLife.
Definition: cells.h:85
static void compute(Board &board)
Computes the next state of the Board based on SmithLife rules.
Definition: cells.cpp:205