Exemplo n.º 1
0
 public override void Init(int width, int height, IntPoint2D[] initialState)
 {
     base.Init(width, height, initialState);
     _stagingBoard = new Toroidal2DBoard <SyncGameOfLifeState>(new IntPoint2D()
     {
         x = width, y = height
     });
 }
Exemplo n.º 2
0
 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);
         }
     }
 }
Exemplo n.º 3
0
    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);
        }
    }