Ejemplo n.º 1
0
        private void InitBoard(InitialState initialState)
        {
            if (initialState == null) throw new ArgumentNullException("initialState");

            var seed = initialState.AliveCells;

            for (var i = 1; i < initialState.InitialDimension + 1; i++)
                for (var j = 1; j < initialState.InitialDimension + 1; j++)
                {
                    var isAlive = seed.Any(cell => cell.X == j && cell.Y == i);
                    Grid.Add(new Cell(i, j, isAlive).AttachToBoard(this));
                }
        }
Ejemplo n.º 2
0
 public GameBoard(InitialState initialState)
     : this()
 {
     InitBoard(initialState);
 }