protected void ProcessBoard(IntPoint2D from, IntPoint2D to, Toroidal2DBoard <StateType> board) { for (int i = from.x; i < to.x; ++i) { for (int j = from.y; j < to.y; ++j) { var coords = new IntPoint2D() { x = i, y = j }; var nextState = _cellularAutomaton.NextState(coords); board.SetState(coords, nextState); } } }
public virtual void Init(int width, int height, IntPoint2D[] initialState) { _width = width; _height = height; _board = new Toroidal2DBoard <StateType>(new IntPoint2D() { x = width, y = height }); _cellularAutomaton = new CellularAutomaton <StateType, IntPoint2D>(_board, new RuleType()); foreach (var point in initialState) { var newState = new StateType(); newState.SetActive(); _board.SetState(point, newState); } }