예제 #1
0
            public void ShouldGenerateInitialBlackMoveCorrectly()
            {
                const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves();
                board.MakeMove(board.Moves[0][0]);
                board.GenerateMoves();
                board.Moves[board.Ply][0].ToSquare.Should().Be(71);
            }
예제 #2
0
            public void ShouldGenerateTwentyInitialReplies()
            {
                const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves();
                board.MakeMove(board.Moves[0][0]);
                board.GenerateMoves();
                board.Moves[board.Ply].Count.Should().Be(20);
            }
예제 #3
0
            public void ShouldGenerateSixteenInitialBlackMoves()
            {
                const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhitePawnPieceList);
                board.Moves[board.Ply].Count.Should().Be(16);
            }
예제 #4
0
            public void ShouldGenerateFourHundredMovesAtDepthOneFromInitialPosition()
            {
                const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves();
                for (int count = 0; count < board.Moves[board.Ply].Count; count++)
                {
                    if (board.MakeMove(board.Moves[0][count]))
                    {
                        board.GenerateMoves();
                        board.TakeMove();
                    }
                }
                board.Moves[0].Count.Should().Be(20);
                board.Moves[1].Count.Should().Be(20);
            }
예제 #5
0
            public void ShouldGenerateFourMovesWhenBlackPawnIsPromoted()
            {
                const string boardSetup = "8/8/8/8/8/8/rrrrrrrp/8 b KQkq - 0 1";
                var          board      = new Game.Board();

                board.ParseFen(boardSetup);

                board.GenerateMoves(board.WhitePawnPieceList);
                board.Moves[board.Ply].Count.Should().Be(4);
            }
예제 #6
0
            public void ShouldGenerateFourteenMovesIfFourteenBlackMovesAreAvailable()
            {
                const string initialBoardSetup = "r7/1ppppppp/8/8/8/8/1PPPPPPP/1NBQKBNR b KQkq - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteRookPieceList);
                board.Moves[board.Ply].Count.Should().Be(14);
            }
예제 #7
0
            public void ShouldGenerateOneMoveIfOneWhiteMoveIsAvailable()
            {
                const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQ1BNR w KQkq - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteQueenPieceList);
                board.Moves[board.Ply].Count.Should().Be(1);
            }
예제 #8
0
            public void ShouldMoveFromCenterToEdgesOfBoard()
            {
                const string initialBoardSetup = "8/8/8/8/3q4/8/8/8 b KQkq - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteQueenPieceList);
                board.Moves[board.Ply].Count.Should().Be(27);
            }
예제 #9
0
            public void ShouldGenerateTwentyNineMovesFromBA3()
            {
                const string boardSetup = "rnbqkbnr/pppp1ppp/4p3/8/1P6/B7/P1PPPPPP/RN1QKBNR b KQkq - 0 1";
                var          board      = new Game.Board();

                board.ParseFen(boardSetup);

                board.GenerateMoves();
                board.Moves[board.Ply].Count.Should().Be(29);
            }
예제 #10
0
            public void ShouldMoveAndCaptureSingleAvailableTarget()
            {
                const string initialBoardSetup = "8/8/pppppppP/6rq/bbbbbbbb/8/8/8 b KQkq - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteQueenPieceList);
                board.Moves[board.Ply].Count.Should().Be(1);
            }
예제 #11
0
            public void ShouldMoveAndCaptureAllAvailableTargets()
            {
                const string initialBoardSetup = "8/8/8/2BBB2/2BqB3/2BBB2/8/8 b KQkq - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteQueenPieceList);
                board.Moves[board.Ply].Count.Should().Be(8);
            }
예제 #12
0
            public void ShouldGenerateAllCaptureMovesIfAllDirectionsAreAvailable()
            {
                const string initialBoardSetup = "8/8/pppppppp/pppKpppp/pppppppp/8/8/8 w - - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteKingPieceList);
                board.Moves[board.Ply].Count.Should().Be(8);
            }
예제 #13
0
            public void ShouldGenerateNoInitialMoves()
            {
                const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteKingPieceList);
                board.Moves[board.Ply].Count.Should().Be(0);
            }
예제 #14
0
            public void ShouldGenerateFourteenMovesIfFourteenWhiteMovesAreAvailable()
            {
                const string initialBoardSetup = "rnbqkbn1/ppppppp1/8/8/8/8/PPPPPPP1/7R w KQkq - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteRookPieceList);
                board.Moves[board.Ply].Count.Should().Be(14);
            }
예제 #15
0
            public void ShouldHaveEightMovesFromTheMiddleOfTheBoard()
            {
                const string initialBoardSetup = "8/8/8/3n4/8/8/8/8 b KQkq - 0 1";

                var board = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteKnightPieceList);
                board.Moves[board.Ply].Count.Should().Be(8);
            }
예제 #16
0
            public void ShouldHaveTwoMovesForBlackKnightOnTheFirstRank()
            {
                const string initialBoardSetup = "rn6/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1";

                var board = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteKnightPieceList);
                board.Moves[board.Ply].Count.Should().Be(2);
            }
예제 #17
0
            public void ShouldUpdatePlyAfterMakingMove()
            {
                const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
                var          board             = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves();
                board.MakeMove(board.Moves[0][0]);
                board.Ply.Should().Be(1);
            }
예제 #18
0
            public void ShouldGenerateTwoMoveWhenOnlyTwoCapturesAreAvailable()
            {
                const string boardSetup =
                    "rnbqkbnr/rnbqkbnr/rnbqkbnr/rnbqbbnr/rnbPkbnr/rnbqkbnr/rnbqkbnr/rnbqkbnr w KQkq - 0 1";
                var board = new Game.Board();

                board.ParseFen(boardSetup);

                board.GenerateMoves(board.WhitePawnPieceList);
                board.Moves[board.Ply].Count.Should().Be(2);
            }
예제 #19
0
            public void ShouldHaveFourInitialMovesForBlack()
            {
                const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1";

                var board = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteKnightPieceList);
                board.Moves[board.Ply].Count.Should().Be(4);
            }
예제 #20
0
            public void ShouldCastleKingSideWhenBlackToMove()
            {
                const string initialBoardSetup = "rnbqk2r/pppppppp/8/8/8/8/PPPPPPPP/RBNQKBNR b KQkq - 0 1";
                var          board             = new Game.Board();

                board.CastlePermission = CastlePermissions.WhiteKing | CastlePermissions.WhiteQueen |
                                         CastlePermissions.BlackKing | CastlePermissions.BlackQueen;
                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteKingPieceList);
                board.Moves[board.Ply].Count.Should().Be(2);
            }
예제 #21
0
            public void ShouldHaveFourInitialMovesForBlackToTheCorrectSquares()
            {
                const string initialBoardSetup = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR b KQkq - 0 1";

                var board = new Game.Board();

                board.ParseFen(initialBoardSetup);

                board.GenerateMoves(board.WhiteKnightPieceList);
                board.Moves[board.Ply][0].PieceToMove.Square.Should().Be(92);
                board.Moves[board.Ply][0].ToSquare.Should().Be(73);
                board.Moves[board.Ply][1].ToSquare.Should().Be(71);
            }