#pragma once #include #include #include #include "io.h" enum BoundaryCondition { BOUNDARY_ONES, BOUNDARY_ZEROS, BOUNDARY_TOROIDAL }; class CellularAutomaton { static const unsigned int m_functionValues = 25 * 11 * 2003 * 18 * 11; int m_fieldWidth, m_fieldHeight; std::vector> m_field; std::vector> m_fieldNextState; BoundaryCondition m_boundaryCondition; void initializeRandom(); void initializeManual(); int getCellState(int x, int y) const; int getNeighborhoodIndex(int x, int y) const; public: CellularAutomaton(int width, int height, bool fillWithRandom, BoundaryCondition boundaryCondition); void update(); void displayField() const; int countLiveCells() const; };