Выбор граничных условий
This commit is contained in:
@@ -4,6 +4,11 @@
|
||||
#include <iostream>
|
||||
#include "io.h"
|
||||
|
||||
enum BoundaryCondition {
|
||||
BOUNDARY_ONES,
|
||||
BOUNDARY_ZEROS,
|
||||
BOUNDARY_TOROIDAL
|
||||
};
|
||||
|
||||
class CellularAutomaton
|
||||
{
|
||||
@@ -12,6 +17,7 @@ class CellularAutomaton
|
||||
int m_fieldWidth, m_fieldHeight;
|
||||
std::vector<std::vector<int>> field;
|
||||
std::vector<std::vector<int>> fieldNextState;
|
||||
BoundaryCondition m_boundaryCondition;
|
||||
|
||||
void initializeRandom();
|
||||
void initializeManual();
|
||||
@@ -19,7 +25,7 @@ class CellularAutomaton
|
||||
int getCellState(int x, int y) const;
|
||||
int getNeighborhoodIndex(int x, int y) const;
|
||||
public:
|
||||
CellularAutomaton(int width, int height, bool fillWithRandom);
|
||||
CellularAutomaton(int width, int height, bool fillWithRandom, BoundaryCondition boundaryCondition);
|
||||
|
||||
void update();
|
||||
void displayField() const;
|
||||
|
||||
Reference in New Issue
Block a user