// Restarts the game. private void RestartBoard() { game.Restart(); for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { this.piecesImg[i, j].Image = game.GetPiece(i, j) == null ? null : ImageHandler.PlaceImage(game.GetPiece(i, j).GetColour(), game.GetPiece(i, j).IsDux(), false); } } }
// Updates the board with moves, deaths, etc. public void UpdateBoard(int srcX, int srcY, int dstX, int dstY) { if (game.GetTurn() == 0) { this.msgBox.Text = msg; } this.piecesImg[srcX, srcY].Image = null; for (int i = -1; i < 2; i += 2) { try { this.piecesImg[dstX + i, dstY].Image = game.GetPiece(dstX + i, dstY) == null ? null : ImageHandler.PlaceImage(game.GetPiece(dstX + i, dstY).GetColour(), game.GetPiece(dstX + i, dstY).IsDux(), false); } catch (System.IndexOutOfRangeException) { } try { this.piecesImg[dstX, dstY + i].Image = game.GetPiece(dstX, dstY + i) == null ? null : ImageHandler.PlaceImage(game.GetPiece(dstX, dstY + i).GetColour(), game.GetPiece(dstX, dstY + i).IsDux(), false); } catch (System.IndexOutOfRangeException) { } } this.piecesImg[dstX, dstY].Image = ImageHandler.PlaceImage(game.GetPiece(dstX, dstY).GetColour(), game.GetPiece(dstX, dstY).IsDux(), false); }