Esempio n. 1
0
        public static bool IsSafe(ChessBoard board)
        {
            ChessBoard tempboard = board.ShallowCopy();

            tempboard.ReverseSides();
            return(WhiteKing.IsSafe(tempboard));
        }
Esempio n. 2
0
        public static List <ChessBoard> GetReversedPossibleWhitePositions(ChessBoard board, char file, sbyte rank, sbyte piece)
        {
            ChessBoard tempboard = board.ShallowCopy();

            tempboard.ReverseSides();
            Square tempsquare = new Square(file, rank);

            tempsquare.Reverse();
            char piecechar = FIDEnotation.GetLetter(piece);

            FIDEnotation.GetPiecePositionsType function = FIDEnotation.GetWhitePiecePositionsType(piecechar);
            List <ChessBoard> result = function(tempboard, tempsquare.file, tempsquare.rank);

            foreach (ChessBoard temp in result)
            {
                temp.ReverseSides();
            }
            return(result);
        }
Esempio n. 3
0
        public static List <Square> GetPossibleWhiteAttackersToSquare(ChessBoard board, Square goalsquare)
        {
            ChessBoard tempboard = board.ShallowCopy();

            tempboard.DebugConsoleSimpleDraw();
            Console.WriteLine();
            tempboard.ReverseSides();
            //tempboard.DebugConsoleSimpleDraw();
            Square tempsquare = new Square(goalsquare.file, goalsquare.rank);

            tempsquare.Reverse();
            var result = WhitePiece.GetPossibleBlackAttackersToSquare(tempboard, tempsquare);

            for (int i = 0; i < result.Count; i++)
            {
                Square temp = result[i];
                temp.Reverse();
                result[i] = temp;
            }
            return(result);
        }