public static object RenderPiece(SizeF SquareSize, Player.PlayerColourNames player, Piece.PieceNames name) { var size = SquareSize; var scale_w = size.Width / (float) PieceRenderer.Size.Width; var scale_h = size.Height / (float) PieceRenderer.Size.Height; UIGraphics.BeginImageContextWithOptions (size, false, 0); try { using (var graphics = UIGraphics.GetCurrentContext ()) { graphics.ScaleCTM (scale_w, scale_h); PieceRenderer.Render (graphics, player, name); return UIGraphics.GetImageFromCurrentImageContext (); } } finally { UIGraphics.EndImageContext (); } }
/// <summary> /// Initializes a new instance of the <see cref="Move"/> class. /// </summary> /// <param name="turnNo"> /// The turn no. /// </param> /// <param name="lastMoveTurnNo"> /// The last move turn no. /// </param> /// <param name="moveName"> /// The move name. /// </param> /// <param name="piece"> /// The piece moving. /// </param> /// <param name="from"> /// The square the peice is moving from. /// </param> /// <param name="to"> /// The square the peice is moving to. /// </param> /// <param name="pieceCaptured"> /// The piece being captured. /// </param> /// <param name="pieceCapturedOrdinal"> /// Ordinal position of the piece being captured. /// </param> /// <param name="score"> /// The positional score. /// </param> public Move(int turnNo, int lastMoveTurnNo, MoveNames moveName, Piece piece, Square from, Square to, Piece pieceCaptured, int pieceCapturedOrdinal, int score) { this.EnemyStatus = Player.PlayerStatusNames.Normal; this.TurnNo = turnNo; this.LastMoveTurnNo = lastMoveTurnNo; this.Name = moveName; this.Piece = piece; this.From = from; this.To = to; this.PieceCaptured = pieceCaptured; this.PieceCapturedOrdinal = pieceCapturedOrdinal; this.Score = score; if (moveName != MoveNames.NullMove && pieceCaptured == null && piece != null && piece.Name != Piece.PieceNames.Pawn) { this.FiftyMoveDrawCounter = Game.MoveHistory.Count > 0 ? Game.MoveHistory.Last.FiftyMoveDrawCounter + 1 : (Game.FiftyMoveDrawBase / 2) + 1; } }
public static void Render (RenderTarget c, Player.PlayerColourNames player, Piece.PieceNames name) { target = c; var color = player == Player.PlayerColourNames.White ? White : Black; var main = color; var alternate = player != Player.PlayerColourNames.White ? White : Black; var white = White; var black = Black; switch (name) { case Piece.PieceNames.Bishop: RenderBishop (c, main, alternate, white, black); break; case Piece.PieceNames.King: if (player == Player.PlayerColourNames.White) RenderWhiteKing (c, main, alternate, white, black); else RenderBlackKing (c, main, alternate, white, black); break; case Piece.PieceNames.Knight: RenderKnight (c, player, main, alternate, white, black); break; case Piece.PieceNames.Pawn: RenderPawn (c, main, alternate, white, black); break; case Piece.PieceNames.Queen: if (player == Player.PlayerColourNames.White) RenderWhiteQueen (c, white, black); else RenderBlackQueen (c); break; case Piece.PieceNames.Rook: if (player == Player.PlayerColourNames.White) RenderWhiteRook (c, white, black); else RenderBlackRook (c); break; } }
public void RecordPossibleKillerMoveTest() { int Ply = 10; KillerMoves.Clear(); Piece piece = new Piece(Piece.PieceNames.Bishop, null, 0, 0, Piece.PieceIdentifierCodes.BlackKingsBishop); Move move1 = new Move(0, 0, Move.MoveNames.Standard, piece, Board.GetSquare(0), Board.GetSquare(1), null, 0, 20); KillerMoves.RecordPossibleKillerMove(Ply, move1); Assert.IsTrue(KillerMoves.RetrieveA(Ply) == move1); Assert.IsNull(KillerMoves.RetrieveB(Ply)); Move move2 = new Move(0, 0, Move.MoveNames.Standard, piece, Board.GetSquare(2), Board.GetSquare(3), null, 0, 10); KillerMoves.RecordPossibleKillerMove(Ply, move2); Assert.IsTrue(KillerMoves.RetrieveA(Ply) == move1); Assert.IsTrue(KillerMoves.RetrieveB(Ply) == move2); Move move3 = new Move(0, 0, Move.MoveNames.Standard, piece, Board.GetSquare(4), Board.GetSquare(5), null, 0, 15); KillerMoves.RecordPossibleKillerMove(Ply, move3); Assert.IsTrue(KillerMoves.RetrieveA(Ply) == move1); Assert.IsTrue(KillerMoves.RetrieveB(Ply) == move3); Move move4 = new Move(0, 0, Move.MoveNames.Standard, piece, Board.GetSquare(6), Board.GetSquare(7), null, 0, 30); KillerMoves.RecordPossibleKillerMove(Ply, move4); Assert.IsTrue(KillerMoves.RetrieveA(Ply) == move4); Assert.IsTrue(KillerMoves.RetrieveB(Ply) == move1); // Start again KillerMoves.Clear(); Move move5 = new Move(0, 0, Move.MoveNames.Standard, piece, Board.GetSquare(16), Board.GetSquare(17), null, 0, 200); KillerMoves.RecordPossibleKillerMove(Ply, move5); Assert.IsTrue(KillerMoves.RetrieveA(Ply) == move5); Assert.IsNull(KillerMoves.RetrieveB(Ply)); Move move6 = new Move(0, 0, Move.MoveNames.Standard, piece, Board.GetSquare(18), Board.GetSquare(19), null, 0, 300); KillerMoves.RecordPossibleKillerMove(Ply, move6); Assert.IsTrue(KillerMoves.RetrieveA(Ply) == move6); Assert.IsTrue(KillerMoves.RetrieveB(Ply) == move5); }
public static bool DoesLeaperPieceTypeAttackSquare(Square square, Player player, PieceNames pieceName, int[] vector, out Piece attackingPiece) { Piece piece; attackingPiece = null; for (int i = 0; i < vector.Length; i++) { piece = Board.GetPiece(square.Ordinal + vector[i]); if (piece != null && piece.Name == pieceName && piece.Player.Colour == player.Colour) { attackingPiece = piece; return true; } } return false; }
public static bool CanPlayerPieceNameAttackSquare(Square square, Player player, Piece.PieceNames PieceName, out Piece attackingPiece) { attackingPiece = null; switch (PieceName) { case PieceNames.Bishop: return PieceBishop.DoesPieceAttackSquare(square, player,out attackingPiece); case PieceNames.King: return PieceKing.DoesPieceAttackSquare(square, player, out attackingPiece); case PieceNames.Knight: return PieceKnight.DoesPieceAttackSquare(square, player, out attackingPiece); case PieceNames.Pawn: return PiecePawn.DoesPieceAttackSquare(square, player, out attackingPiece); case PieceNames.Queen: return PieceQueen.DoesPieceAttackSquare(square, player, out attackingPiece); case PieceNames.Rook: return PieceRook.DoesPieceAttackSquare(square, player, out attackingPiece); } return false; }
/// <summary> /// The move piece to fen position. /// </summary> /// <param name="charToken"> /// The char token. /// </param> /// <param name="intFile"> /// The int file. /// </param> /// <param name="intRank"> /// The int rank. /// </param> /// <param name="blnAnyLocation"> /// The bln any location. /// </param> /// <param name="blnAllowPromotion"> /// The bln allow promotion. /// </param> private static void MovePieceToFenPosition( ref char charToken, int intFile, int intRank, bool blnAnyLocation, bool blnAllowPromotion) { Piece.PieceNames piecename = Piece.PieceNames.King; Player player = charToken.ToString() == charToken.ToString().ToUpper() ? Game.PlayerWhite : Game.PlayerBlack; switch (charToken.ToString().ToUpper()) { case "K": piecename = Piece.PieceNames.King; break; case "Q": piecename = Piece.PieceNames.Queen; break; case "R": piecename = Piece.PieceNames.Rook; break; case "B": piecename = Piece.PieceNames.Bishop; break; case "N": piecename = Piece.PieceNames.Knight; break; case "P": piecename = Piece.PieceNames.Pawn; break; } // Try to find the required piece in from the available pool of captured // pieces that haven't been placed on the board yet. Piece pieceToUse = null; foreach (Piece pieceCaptured in player.OpposingPlayer.CapturedEnemyPieces) { if ((pieceCaptured.Name == piecename || (blnAllowPromotion && pieceCaptured.Name == Piece.PieceNames.Pawn)) && (pieceCaptured.StartLocation == Board.GetSquare(intFile, intRank) || blnAnyLocation)) { pieceToUse = pieceCaptured; break; } } if (pieceToUse != null) { Square square = Board.GetSquare(intFile, intRank); pieceToUse.Uncapture(0); square.Piece = pieceToUse; pieceToUse.Square = square; pieceToUse.NoOfMoves = blnAnyLocation ? 1 : 0; if (pieceToUse.Name != piecename) { pieceToUse.Promote(piecename); } // Mark the token in the original FEN string with a * to indicate that the piece has been processed charToken = '.'; } }
/// <summary> /// The add. /// </summary> /// <param name="piece"> /// The piece. /// </param> public void Add(Piece piece) { this.pieces.Add(piece); }
/// <summary> /// Remove the piece from the list. /// </summary> /// <param name="piece"> /// The piece to remove. /// </param> public void Remove(Piece piece) { this.pieces.Remove(piece); }
/// <summary> /// The set board position. /// </summary> /// <param name="fenString"> /// The str fen. /// </param> public static void SetBoardPosition(string fenString) { string strActiveColour = "w"; string strCastlingRights = string.Empty; string strEnPassant = "-"; string strHalfMoveClock = "0"; string strFullMoveNumber = "1"; Game.FenStartPosition = fenString; Game.CaptureAllPieces(); Game.DemoteAllPieces(); // Break up the string into its various parts // rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 fenString += " "; // Piece Placement int pos = fenString.IndexOf(" "); char[] acharPiecePlacement = fenString.ToCharArray(0, pos); fenString = fenString.Substring(pos + 1); // Active Colour pos = fenString.IndexOf(" "); if (pos > -1) { strActiveColour = fenString.Substring(0, pos); fenString = fenString.Substring(pos + 1); } // Castling Rights pos = fenString.IndexOf(" "); if (pos > -1) { strCastlingRights = fenString.Substring(0, pos); fenString = fenString.Substring(pos + 1); } // En passant pos = fenString.IndexOf(" "); if (pos > -1) { strEnPassant = fenString.Substring(0, pos); fenString = fenString.Substring(pos + 1); } // Half move clock pos = fenString.IndexOf(" "); if (pos > -1) { strHalfMoveClock = fenString.Substring(0, pos); fenString = fenString.Substring(pos + 1); } // Full move number pos = fenString.IndexOf(" "); if (pos > -1) { strFullMoveNumber = fenString.Substring(0, pos); } // Match FEN pieces against actual pieces, and move them onto the board // Pass 1: Match piece name and location exactly SetPiecePlacement(ref acharPiecePlacement, false, false); // Pass 2: Match piece name SetPiecePlacement(ref acharPiecePlacement, true, false); // Pass 3: For non-pawns and not the king, allow pawns to be promoted to the named piece SetPiecePlacement(ref acharPiecePlacement, true, true); // Set player to play Game.PlayerToPlay = strActiveColour == "b" ? Game.PlayerBlack : Game.PlayerWhite; // Set castling rights Piece pieceRook; // White King's Rook if ((pieceRook = Board.GetPiece(7, 0)) != null && pieceRook.Name == Piece.PieceNames.Rook && pieceRook.Player.Colour == Player.PlayerColourNames.White) { pieceRook.NoOfMoves = strCastlingRights.LastIndexOf("K") >= 0 ? 0 : 1; } // Black King's Rook if ((pieceRook = Board.GetPiece(7, 7)) != null && pieceRook.Name == Piece.PieceNames.Rook && pieceRook.Player.Colour == Player.PlayerColourNames.Black) { pieceRook.NoOfMoves = strCastlingRights.LastIndexOf("k") >= 0 ? 0 : 1; } // White Queen's Rook if ((pieceRook = Board.GetPiece(0, 0)) != null && pieceRook.Name == Piece.PieceNames.Rook && pieceRook.Player.Colour == Player.PlayerColourNames.White) { pieceRook.NoOfMoves = strCastlingRights.LastIndexOf("Q") >= 0 ? 0 : 1; } // Black Queen's Rook if ((pieceRook = Board.GetPiece(0, 7)) != null && pieceRook.Name == Piece.PieceNames.Rook && pieceRook.Player.Colour == Player.PlayerColourNames.Black) { pieceRook.NoOfMoves = strCastlingRights.LastIndexOf("q") >= 0 ? 0 : 1; } // Half move (50 move draw) clock. Game.FiftyMoveDrawBase = int.Parse(strHalfMoveClock); // Full move number. Default 1. Must be defined before En Passant. Game.TurnNo = (int.Parse(strFullMoveNumber) - 1) << 1; if (Game.PlayerToPlay.Colour == Player.PlayerColourNames.Black) { Game.TurnNo++; // Always odd for the previous White's move } // En Passant if (strEnPassant[0] != '-') { int indFile = Board.FileFromName(Convert.ToString(strEnPassant[0])); int indRank = int.Parse(Convert.ToString(strEnPassant[1])); if (indRank == 6) { // if fenString = "e6" indRank = 4; // last move was e7-e5 so indRank = 6 - 2 = 4 } // else if indRank = 3, fenString = "e3" last move was e2-e4 so indRank = 3 Piece piecePassed = Board.GetPiece(indFile, indRank); piecePassed.NoOfMoves = 1; piecePassed.LastMoveTurnNo = Game.TurnNo; } // Recalculate the hashkey for the current position. Board.EstablishHashKey(); VerifyPiecePlacement(ref acharPiecePlacement); }
/// <summary> /// Make the specified move. For internal use only. /// </summary> /// <param name="moveName"> The move name. </param> /// <param name="piece"> The piece to move. </param> /// <param name="square"> The square to move to. </param> private static void MakeAMoveInternal(Move.MoveNames moveName, Piece piece, Square square) { MoveRedoList.Clear(); Move move = piece.Move(moveName, square); move.EnemyStatus = move.Piece.Player.OpposingPlayer.Status; PlayerToPlay.Clock.Stop(); MoveHistory.Last.TimeStamp = PlayerToPlay.Clock.TimeElapsed; if (PlayerToPlay.Intellegence == Player.PlayerIntellegenceNames.Computer) { WinBoard.SendMove(move); if (!PlayerToPlay.OpposingPlayer.CanMove) { if (PlayerToPlay.OpposingPlayer.IsInCheckMate) { WinBoard.SendCheckMate (); } else if (!PlayerToPlay.OpposingPlayer.IsInCheck) { WinBoard.SendCheckStaleMate (); } } else if (PlayerToPlay.OpposingPlayer.CanClaimThreeMoveRepetitionDraw == true) { WinBoard.SendDrawByRepetition (); } else if (PlayerToPlay.OpposingPlayer.CanClaimFiftyMoveDraw == true) { WinBoard.SendDrawByFiftyMoveRule (); } else if (PlayerToPlay.OpposingPlayer.CanClaimInsufficientMaterialDraw == true) { WinBoard.SendDrawByInsufficientMaterial (); } } BroadcastMovedName (move); CheckGameStatus (); PlayerToPlay = PlayerToPlay.OpposingPlayer; PlayerToPlay.Clock.Start(); }
/// <summary> /// Determines of the player has the specified piece. /// </summary> /// <param name="piecename"> /// The piecename. /// </param> /// <returns> /// True if player has the piece. /// </returns> public bool HasPieceName(Piece.PieceNames piecename) { if (piecename == Piece.PieceNames.Pawn && this.PawnCountInPlay > 0) { return true; } foreach (Piece piece in this.Pieces) { if (piece.Name == piecename) { return true; } } return false; }
/// <summary> /// The append piece path. /// </summary> /// <param name="moves"> /// The moves. /// </param> /// <param name="piece"> /// The piece. /// </param> /// <param name="player"> /// The player. /// </param> /// <param name="offset"> /// The offset. /// </param> /// <param name="movesType"> /// The moves type. /// </param> public static void AppendPiecePath( Moves moves, Piece piece, Player player, int offset, Moves.MoveListNames movesType) { int intOrdinal = piece.Square.Ordinal; Square square; intOrdinal += offset; while ((square = GetSquare(intOrdinal)) != null) { if (square.Piece == null) { if (movesType == Moves.MoveListNames.All) { moves.Add(0, 0, Move.MoveNames.Standard, piece, piece.Square, square, null, 0, 0); } } else if (square.Piece.Player.Colour != player.Colour && square.Piece.IsCapturable) { moves.Add(0, 0, Move.MoveNames.Standard, piece, piece.Square, square, square.Piece, 0, 0); break; } else { break; } intOrdinal += offset; } }
// end FenGet1Pieces /// <summary> /// FEN notation of castling availability of the King in the future /// </summary> /// <param name="pieceKing"> /// the White or Black King /// </param> /// <param name="fenString"> /// <list type="bullet"> /// <item> /// append "K" if White castling availability /// </item> /// <item> /// append "Q" if White castling availability both /// </item> /// <item> /// append "k" if Black castling availability both Rook-side /// </item> /// <item> /// append "q" if Black castling availability both Queen-side /// </item> /// <item> /// append "KQkq" if O-O and O-O-O for White first then Black /// </item> /// </list> /// </param> /// <returns> /// The fen get 3 castling future. /// </returns> private static bool FenGet3CastlingIsPossible(Piece pieceKing, StringBuilder fenString) { bool canCastle = false; if (((PieceKing)pieceKing.Top).CanCastleKingSide) { // King could castle Rook-side in the future fenString.Append((pieceKing.Player.Colour == Player.PlayerColourNames.White) ? "K" : "k"); canCastle = true; } if (((PieceKing)pieceKing.Top).CanCastleQueenSide) { // King could castle Queen-side in the future fenString.Append((pieceKing.Player.Colour == Player.PlayerColourNames.White) ? "Q" : "q"); canCastle = true; } return canCastle; }
/// <summary> /// Initializes a new instance of the <see cref="Moves"/> class. /// </summary> /// <param name="pieceParent"> /// The piece parent. /// </param> public Moves(Piece pieceParent) { this.Parent = pieceParent; }
/// <summary> /// The add. /// </summary> /// <param name="turnNo"> /// The turn no. /// </param> /// <param name="lastMoveTurnNo"> /// The last move turn no. /// </param> /// <param name="moveName"> /// The move name. /// </param> /// <param name="piece"> /// The piece moving. /// </param> /// <param name="from"> /// The square the peice is moving from. /// </param> /// <param name="to"> /// The square the peice is moving to. /// </param> /// <param name="pieceCaptured"> /// The piece being captured. /// </param> /// <param name="pieceCapturedOrdinal"> /// Ordinal position of the piece being captured. /// </param> /// <param name="score"> /// The positional score. /// </param> public void Add(int turnNo, int lastMoveTurnNo, Move.MoveNames moveName, Piece piece, Square from, Square to, Piece pieceCaptured, int pieceCapturedOrdinal, int score) { this.moves.Add(new Move(turnNo, lastMoveTurnNo, moveName, piece, from, to, pieceCaptured, pieceCapturedOrdinal, score)); }
static public bool DoesPieceAttackSquare(Square square, Player player, out Piece attackingPiece) { attackingPiece = null; Piece piece; piece = Board.GetPiece(square.Ordinal - player.PawnAttackLeftOffset); if (piece != null && piece.Name == _pieceType && piece.Player.Colour == player.Colour) { attackingPiece = piece; return true; } piece = Board.GetPiece(square.Ordinal - player.PawnAttackRightOffset); if (piece != null && piece.Name == _pieceType && piece.Player.Colour == player.Colour) { attackingPiece = piece; return true; } return false; }
/// <summary> /// Initializes a new instance of the <see cref="PieceKnight"/> class. /// </summary> /// <param name="pieceBase"> /// The piece base. /// </param> public PieceKnight(Piece pieceBase) { this.Base = pieceBase; }
public static bool DoesPieceAttackSquare(Square square, Player player, out Piece attackingPiece) { return Piece.DoesLeaperPieceTypeAttackSquare(square, player, _pieceType, moveVectors, out attackingPiece); }
/// <summary> /// Initializes a new instance of the <see cref="PiecePawn"/> class. /// </summary> /// <param name="pieceBase"> /// The piece base. /// </param> public PiecePawn(Piece pieceBase) { this.Base = pieceBase; }
/// <summary> /// Get this cursor for the specfied piece /// </summary> /// <param name="piece"> /// The piece. /// </param> private Cursor GetPieceCursor(Piece piece) { return this.m_acurPieceCursors[piece.ImageIndex]; }
/// <summary> /// The lines first piece. /// </summary> /// <param name="colour"> /// The colour. /// </param> /// <param name="pieceName"> /// The piece name. /// </param> /// <param name="squareStart"> /// The square start. /// </param> /// <param name="offset"> /// The offset. /// </param> /// <returns> /// The first piece on the line, or null. /// </returns> public static Piece LinesFirstPiece( Player.PlayerColourNames colour, Piece.PieceNames pieceName, Square squareStart, int offset) { int intOrdinal = squareStart.Ordinal; Square square; intOrdinal += offset; while ((square = GetSquare(intOrdinal)) != null) { if (square.Piece == null) { } else if (square.Piece.Player.Colour != colour) { return null; } else if (square.Piece.Name == pieceName || square.Piece.Name == Piece.PieceNames.Queen) { return square.Piece; } else { return null; } intOrdinal += offset; } return null; }
/// <summary> /// The get piece image. /// </summary> /// <param name="piece"> /// The piece. /// </param> /// <returns> /// </returns> private Image GetPieceImage(Piece piece) { return this.imgPieces.Images[piece.ImageIndex]; }
public void SameKillerMoveWithHigherScoreReplacesSlotEntry() { const int Ply = 10; KillerMoves.Clear(); Piece piece = new Piece(Piece.PieceNames.Bishop, null, 0, 0, Piece.PieceIdentifierCodes.BlackKingsBishop); Move move1 = new Move(0, 0, Move.MoveNames.Standard, piece, Board.GetSquare(0), Board.GetSquare(1), null, 0, 20); // Add a move KillerMoves.RecordPossibleKillerMove(Ply, move1); Assert.IsTrue(KillerMoves.RetrieveA(Ply) == move1); Assert.IsTrue(KillerMoves.RetrieveA(Ply).Score == 20); Assert.IsNull(KillerMoves.RetrieveB(Ply)); // Add same move AGAIN, but with higher score. Move should be replaced, using higher score. Move move2 = new Move(0, 0, Move.MoveNames.Standard, piece, Board.GetSquare(0), Board.GetSquare(1), null, 0, 30); KillerMoves.RecordPossibleKillerMove(Ply, move2); Assert.IsTrue(KillerMoves.RetrieveA(Ply) == move2); Assert.IsTrue(KillerMoves.RetrieveA(Ply).Score == 30); Assert.IsNull(KillerMoves.RetrieveB(Ply)); // Add same move AGAIN, but with LOWER score. No killer moves should be changed Move move3 = new Move(0, 0, Move.MoveNames.Standard, piece, Board.GetSquare(0), Board.GetSquare(1), null, 0, 10); KillerMoves.RecordPossibleKillerMove(Ply, move3); Assert.IsTrue(Move.MovesMatch(KillerMoves.RetrieveA(Ply), move2)); Assert.IsTrue(KillerMoves.RetrieveA(Ply).Score == 30); Assert.IsNull(KillerMoves.RetrieveB(Ply)); // Now add a different move, and check it goes in slot B Move move4 = new Move(0, 0, Move.MoveNames.Standard, piece, Board.GetSquare(2), Board.GetSquare(3), null, 0, 5); KillerMoves.RecordPossibleKillerMove(Ply, move4); Assert.IsTrue(Move.MovesMatch(KillerMoves.RetrieveA(Ply), move3)); Assert.IsTrue(KillerMoves.RetrieveA(Ply).Score == 30); Assert.IsTrue(Move.MovesMatch(KillerMoves.RetrieveB(Ply), move4)); Assert.IsTrue(KillerMoves.RetrieveB(Ply).Score == 5); // Now improve score of the move that is in slot B. // Slot B's score should be updated. Slot A should stay the same. // Slot's A & B should be SWAPPED. Move move5 = new Move(0, 0, Move.MoveNames.Standard, piece, Board.GetSquare(2), Board.GetSquare(3), null, 0, 100); KillerMoves.RecordPossibleKillerMove(Ply, move5); Assert.IsTrue(Move.MovesMatch(KillerMoves.RetrieveA(Ply), move5)); Assert.IsTrue(KillerMoves.RetrieveA(Ply).Score == 100); Assert.IsTrue(Move.MovesMatch(KillerMoves.RetrieveB(Ply), move3)); Assert.IsTrue(KillerMoves.RetrieveB(Ply).Score == 30); }
/// <summary> /// Searches for the specified piece and returns its index. /// </summary> /// <param name="piece"> /// The piece to search for. /// </param> /// <returns> /// Index value of the found piece. or null if not found. /// </returns> public int IndexOf(Piece piece) { return this.pieces.IndexOf(piece); }
/// <summary> /// Make a move. /// </summary> /// <param name="moveName"> The move name. </param> /// <param name="piece"> The piece to move. </param> /// <param name="square"> The square to move to. </param> public static void MakeAMove(Move.MoveNames moveName, Piece piece, Square square) { SuspendPondering(); MakeAMoveInternal(moveName, piece, square); SaveBackup(); SendBoardPositionChangeEvent(); // CheckIfAutoNextMove(); }
/// <summary> /// Insert a piece into the list. at the specified index position. /// </summary> /// <param name="ordinal"> /// The ordinal index position where the piece will be inserted. /// </param> /// <param name="piece"> /// The piece. /// </param> public void Insert(int ordinal, Piece piece) { this.pieces.Insert(ordinal, piece); }