public void RestartGame() { for (int i = 0; i < MatrixBoard.GetLength(0); i++) { for (int j = 0; j < MatrixBoard.GetLength(1); j++) { MatrixBoard[i, j] = null; } } StartGame(); }
private void RefreshGrid(Piece piece) { var position = piece.Position; var rowLength = MatrixBoard.GetLength(0); var colLength = MatrixBoard.GetLength(1); for (var row = position.Row - 1; row <= position.Row + 1; row++) { for (var col = position.Column - 1; col <= position.Column + 1; col++) { if (row >= 0 && row < rowLength && col >= 0 && col < colLength && position.Row != row && position.Column != col && !HasPiece(new Position(row, col))) { MatrixBoard[row, col].AddSurroundingPiece(piece); } } } }