Пример #1
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));
        }
Пример #2
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);
        }