public void TestGetCells() { ICellFactory factory = new GridCellFactory(4, 4); IPlayField playField = new GridPlayField(factory,4, 4); playField.InitializePlayField("01001101001"); AbstractCell[,] cells = playField.GetCells(); for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) Assert.AreEqual(cells[i, j], playField.GetCell(i, j)); }
public IPlayField Clone() { ICellFactory cellFactory = new GridCellFactory(_rows,_columns); IPlayField playFieldGrid = new GridPlayField(cellFactory,_rows, _columns); AbstractCell[,] gridCopy = playFieldGrid.GetCells(); // get reference to this class's grid for (int row = 0; row < _rows; row++) for (int column = 0; column < _columns; column++) gridCopy[row, column] = GetCell(row, column).Clone(); playFieldGrid.IncreaseGeneration(CurrentGeneration); return playFieldGrid; }