-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCellularAutomata.h
59 lines (49 loc) · 1.38 KB
/
CellularAutomata.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// Created by archie on 4/17/17.
//
#include <fstream>
#include <iostream>
#include <cmath>
#include <map>
#include <vector>
#include "params.h"
#ifndef BIN_EVO_PROJEKT_CELLULARAUTOMATA_H
#define BIN_EVO_PROJEKT_CELLULARAUTOMATA_H
using namespace std;
class CellularAutomata {
public:
CellularAutomata();
int mathFunction(const vector<int> &cellNeighbours);
int maxValueFromFunction = MAXRULES; // TODO: ZMENIT PRI ZMENE FUNKCIE
vector<int> rulesVector;
void initializeCA();
void setFirstState();
void exportCurrentState(string filename);
int updateFunction();
int updateFunction(const vector<int> &cellNeighbours);
int valueOfcenterOfNeigh;
int rowOfCenterOfNeigh;
int colOfCenterOfNeigh;
void develop();
void runSimulation();
void exportRules(string filename);
void swapMaps();
//MUST BE THE SAME
int heigth = SIZEOFCA;
int width = SIZEOFCA;
vector< vector <int> > currentMap;
vector<vector< vector <int> >> oldStates;
bool isDead();
int changedStates;
int stepsWithChangedStates;
bool isCrossedOver;
vector<vector< vector <int> >>mapWithVisitedStates;
private:
vector< vector <int> > newMap;
ofstream* fout;
int neighbourhoodSize = NEIGHBOURHOOD;
int states = STATES;
int simulationSteps = SIMULATIONSTEPS;
int mathFunction();
};
#endif //BIN_EVO_PROJEKT_CELLULARAUTOMATA_H