Exemplo n.º 1
0
 //Получить возможные ходы
 public List <string> GetAllAvaibleMoves(string pieceSquare = "none")
 {
     if (pieceSquare == "none")
     {
         return(moves.GetPlayerMoves(player1.playerColor));
     }
     else
     {
         return(moves.GetPieceMoves(player1.playerColor, pieceSquare));
     }
 }
Exemplo n.º 2
0
        //Проверка на шах
        public bool IsCheck()
        {
            Color inGameColor            = desk.notation.InGameColor;
            ForsythEdwardsNotation copyN = (ForsythEdwardsNotation)desk.notation.Clone();
            Desk        copyDesk         = new Desk(copyN);
            Moves       copyMoves        = new Moves(copyDesk);
            ChessPlayer op = new Bot(inGameColor.FlipColor(), copyMoves, copyDesk);

            return(copyDesk.IsKingInDanger(copyMoves.GetPlayerMoves(op.playerColor), inGameColor));
        }
Exemplo n.º 3
0
        public bool IsMateAfterMove(string move, Vectors vector)
        {
            bool      result;
            PieceMove pieceMove          = new PieceMove(inGameColor, move);
            ForsythEdwardsNotation copyN = (ForsythEdwardsNotation)desk.notation.Clone();
            Desk  copyDesk  = new Desk(copyN);
            Moves copyMoves = new Moves(copyDesk);

            copyDesk.UpdatePiecesOnDesk(pieceMove, inGameColor);
            ChessPlayer op = new Bot(inGameColor.FlipColor(), copyMoves, copyDesk);

            result = copyDesk.IsKingInDanger(copyMoves.GetPlayerMoves(op.playerColor), inGameColor);

            if (result && vector.status != "recalculate")
            {
                vector.status = "recalculate";
                RecalculatedPiecesPosition.Add(pieceMove.from);
            }
            return(result);
        }