示例#1
0
        private static void blackqueensidecastle()
        {
            //Winboard winboard = new Winboard();
            ChessBoard lolBoard = new ChessBoard();

            lolBoard.InitializeGame();

            //White
            PawnBitBoard pawnWhite = new PawnBitBoard(ChessPieceColors.White);

            pawnWhite.Bits = BoardSquare.A2 | BoardSquare.B2 | BoardSquare.C2 | BoardSquare.D2 | BoardSquare.E4 | BoardSquare.H3;

            BishopBitBoard bishopWhite = new BishopBitBoard(ChessPieceColors.White);

            bishopWhite.Bits = BoardSquare.C1;

            KingBitBoard kingWhite = new KingBitBoard(ChessPieceColors.White);

            kingWhite.Bits = BoardSquare.D3;

            RookBitBoard rookWhite = new RookBitBoard(ChessPieceColors.White);

            rookWhite.Bits = BoardSquare.A1 | BoardSquare.H1;

            KnightBitBoard knightWhite = new KnightBitBoard(ChessPieceColors.White);

            knightWhite.Bits = BoardSquare.D2;

            QueenBitBoard queenWhite = new QueenBitBoard(ChessPieceColors.White);

            queenWhite.Bits = BoardSquare.D1;

            //Black
            PawnBitBoard pawnBlack = new PawnBitBoard(ChessPieceColors.Black);

            pawnBlack.Bits = BoardSquare.A7 | BoardSquare.B7 | BoardSquare.C7 | BoardSquare.C6 | BoardSquare.F7 | BoardSquare.G7 | BoardSquare.H7;

            RookBitBoard rookBlack = new RookBitBoard(ChessPieceColors.Black);

            rookBlack.Bits = BoardSquare.A8 | BoardSquare.H8;

            BishopBitBoard bishopBlack = new BishopBitBoard(ChessPieceColors.Black);

            bishopBlack.Bits = BoardSquare.F5 | BoardSquare.H4;

            QueenBitBoard queenBlack = new QueenBitBoard(ChessPieceColors.Black);

            queenBlack.Bits = BoardSquare.F2;

            KingBitBoard kingBlack = new KingBitBoard(ChessPieceColors.Black);

            kingBlack.Bits = BoardSquare.E8;

            KnightBitBoard knightBlack = new KnightBitBoard(ChessPieceColors.Black);

            knightBlack.Bits = BoardSquare.H6;


            //RookBitBoard badMove = new RookBitBoard( ChessPieceColors.Black );
            //badMove.Bits = BoardSquare.B8;
            lolBoard.Update(pawnWhite);
            lolBoard.Update(knightWhite);
            lolBoard.Update(queenWhite);
            lolBoard.Update(rookWhite);
            lolBoard.Update(bishopWhite);
            lolBoard.Update(kingWhite);
            lolBoard.Update(pawnBlack);
            lolBoard.Update(rookBlack);
            lolBoard.Update(bishopBlack);
            lolBoard.Update(queenBlack);
            lolBoard.Update(kingBlack);
            lolBoard.Update(knightBlack);
            KingBitBoard test = new KingBitBoard(ChessPieceColors.Black);

            test.Bits = BoardSquare.C8;
            lolBoard.Update(test);

            List <ColoredBitBoard> legalMoves = new List <ColoredBitBoard>();

            legalMoves = MoveGen.GenerateLegalMoves(lolBoard, ChessPieceColors.Black);
            ColoredBitBoard bestMove = NegaMax.GetBestMove(lolBoard, 3, ChessPieceColors.White, MoveGen.GenerateLegalMoves, Eval.EvaluateState);

            Console.Write(legalMoves.ToString() + bestMove.ToString());
        }
示例#2
0
        private static void sacrificeQueenDebugStuffSomethingTestMethod()
        {
            //Winboard winboard = new Winboard();
            ChessBoard lolBoard = new ChessBoard();

            lolBoard.InitializeGame();

            //White
            PawnBitBoard pawnWhite = new PawnBitBoard(ChessPieceColors.White);

            pawnWhite.Bits = BoardSquare.A4 | BoardSquare.C2 | BoardSquare.D3 | BoardSquare.E4 | BoardSquare.F2 | BoardSquare.G2;

            BishopBitBoard bishopWhite = new BishopBitBoard(ChessPieceColors.White);

            bishopWhite.Bits = BoardSquare.E2 | BoardSquare.H4;

            KingBitBoard kingWhite = new KingBitBoard(ChessPieceColors.White);

            kingWhite.Bits = BoardSquare.E1;

            RookBitBoard rookWhite = new RookBitBoard(ChessPieceColors.White);

            rookWhite.Bits = BoardSquare.B1 | BoardSquare.H1;

            KnightBitBoard knightWhite = new KnightBitBoard(ChessPieceColors.White);

            knightWhite.Bits = BoardSquare.D2;

            QueenBitBoard queenWhite = new QueenBitBoard(ChessPieceColors.White);

            queenWhite.Bits = BoardSquare.D1;

            //Black
            PawnBitBoard pawnBlack = new PawnBitBoard(ChessPieceColors.Black);

            pawnBlack.Bits = BoardSquare.A7 | BoardSquare.B7 | BoardSquare.C5 | BoardSquare.E5 | BoardSquare.H5;
            RookBitBoard rookBlack = new RookBitBoard(ChessPieceColors.Black);

            rookBlack.Bits = BoardSquare.A8 | BoardSquare.H7;

            BishopBitBoard bishopBlack = new BishopBitBoard(ChessPieceColors.Black);

            bishopBlack.Bits = BoardSquare.C8 | BoardSquare.F8;

            QueenBitBoard queenBlack = new QueenBitBoard(ChessPieceColors.Black);

            queenBlack.Bits = BoardSquare.B4;

            KingBitBoard kingBlack = new KingBitBoard(ChessPieceColors.Black);

            kingBlack.Bits = BoardSquare.F7;

            KnightBitBoard knightBlack = new KnightBitBoard(ChessPieceColors.Black);

            knightBlack.Bits = BoardSquare.B8;


            //RookBitBoard badMove = new RookBitBoard( ChessPieceColors.Black );
            //badMove.Bits = BoardSquare.B8;
            lolBoard.Update(pawnWhite);
            lolBoard.Update(knightWhite);
            lolBoard.Update(queenWhite);
            lolBoard.Update(rookWhite);
            lolBoard.Update(bishopWhite);
            lolBoard.Update(kingWhite);
            lolBoard.Update(pawnBlack);
            lolBoard.Update(rookBlack);
            lolBoard.Update(bishopBlack);
            lolBoard.Update(queenBlack);
            lolBoard.Update(kingBlack);
            lolBoard.Update(knightBlack);

            List <ColoredBitBoard> legalMoves = new List <ColoredBitBoard>();

            legalMoves = MoveGen.GenerateLegalMoves(lolBoard, ChessPieceColors.Black);
            ColoredBitBoard bestMove = NegaMax.GetBestMove(lolBoard, 3, ChessPieceColors.Black, MoveGen.GenerateLegalMoves, Eval.EvaluateState);

            Console.Write(legalMoves.ToString() + bestMove.ToString());
        }
示例#3
0
        private static void KingSideCastlingFAIL()
        {
            ChessBoard lolBoard = new ChessBoard();

            lolBoard.InitializeGame();

            //White
            PawnBitBoard pawnWhite = new PawnBitBoard(ChessPieceColors.White);

            pawnWhite.Bits = BoardSquare.A4 | BoardSquare.B4 | BoardSquare.C2 | BoardSquare.F4 | BoardSquare.H5;

            BishopBitBoard bishopWhite = new BishopBitBoard(ChessPieceColors.White);

            bishopWhite.Bits = BoardSquare.E3;

            RookBitBoard rookWhite = new RookBitBoard(ChessPieceColors.White);

            rookWhite.Bits = BoardSquare.C1 | BoardSquare.H1;

            KnightBitBoard knightWhite = new KnightBitBoard(ChessPieceColors.White);

            knightWhite.Bits = BoardSquare.G1;

            QueenBitBoard queenWhite = new QueenBitBoard(ChessPieceColors.White);

            queenWhite.Bits = 0;

            KingBitBoard kingWhite = new KingBitBoard(ChessPieceColors.White);

            kingWhite.Bits = BoardSquare.F2;

            //black
            PawnBitBoard pawnBlack = new PawnBitBoard(ChessPieceColors.Black);

            pawnBlack.Bits = BoardSquare.A7 | BoardSquare.B7 | BoardSquare.E7 | BoardSquare.E4 | BoardSquare.G4 | BoardSquare.G5 | BoardSquare.H7;

            BishopBitBoard bishopBlack = new BishopBitBoard(ChessPieceColors.Black);

            bishopBlack.Bits = BoardSquare.C3 | BoardSquare.C4;

            RookBitBoard rookBlack = new RookBitBoard(ChessPieceColors.Black);

            rookBlack.Bits = BoardSquare.A8 | BoardSquare.H8;

            KnightBitBoard knightBlack = new KnightBitBoard(ChessPieceColors.Black);

            knightBlack.Bits = BoardSquare.D4;

            QueenBitBoard queenBlack = new QueenBitBoard(ChessPieceColors.Black);

            queenBlack.Bits = 0;

            KingBitBoard kingBlack = new KingBitBoard(ChessPieceColors.Black);

            kingBlack.Bits = BoardSquare.G8;

            //Update

            lolBoard.Update(pawnWhite);
            lolBoard.Update(knightWhite);
            lolBoard.Update(queenWhite);
            lolBoard.Update(rookWhite);
            lolBoard.Update(bishopWhite);
            lolBoard.Update(kingWhite);
            lolBoard.Update(pawnBlack);
            lolBoard.Update(bishopBlack);
            lolBoard.Update(queenBlack);
            lolBoard.Update(knightBlack);
            lolBoard.Update(kingBlack);

            List <ColoredBitBoard> legalMoves = new List <ColoredBitBoard>();

            legalMoves = MoveGen.GenerateLegalMoves(lolBoard, ChessPieceColors.White);
            ColoredBitBoard bestMove = NegaMax.GetBestMove(lolBoard, 3, ChessPieceColors.White, MoveGen.GenerateLegalMoves, Eval.EvaluateState);
        }