public ChessMove(BoardSquare start, BoardSquare end, char pieceMoved, bool isCapture, Piece promotedPiece) { this.startSquare = start; this.endSquare = end; this.pieceMoved = pieceMoved; this.checkIndicator = '\0'; this.isCapture = isCapture; if (promotedPiece != null) this.promotedPiece = promotedPiece.Notational; // Determine if the move resulted in castling if (this.pieceMoved == (char)Piece.PieceNotation.King && start.X - end.X == 2) this.castleNotation = CASTLE_QUEEN; else if (this.pieceMoved == (char)Piece.PieceNotation.King && start.X - end.X == -2) this.castleNotation = CASTLE_KING; else this.castleNotation = String.Empty; }
public static bool AreEqual(Piece a, Piece b) { if (a == null && b == null) return true; else if (a == null ^ b == null) return false; else return a.colour == b.colour && a.GetType() == b.GetType(); }
public void SetPromotedValue(BoardSquare square, Piece newPiece) { if (square.Y == (whiteTurn ? 0 : Board.NUM_ROWS - 1)) { Piece endSquare = board[square]; if (endSquare != null && endSquare is Pawn) { board[square] = newPiece; IsGameOver(ChessMove.MoveStatusCodes.pawnPromote, this.endCoord); } } }