示例#1
0
        public void GeneratesNoCastlingMovesWhenNotAvailable()
        {
            // Assemble
            var board = new Board
            {
                WhiteKing  = 0x00_00_00_00_00_00_00_10,
                WhiteRooks = 0x00_00_00_00_00_00_00_81
            };

            var position = new Position(board, Side.White, null, CastlingRights.None, 0);
            var moves    = new List <Move>();

            // Act
            MoveGenerator.AddCastlingMoves(position, moves);

            // Assert
            moves.Should().BeEmpty();
        }
示例#2
0
        public void NoCastlingWhenMovingThroughCheck()
        {
            // Assemble
            var board = new Board
            {
                WhiteKing  = 0x00_00_00_00_00_00_00_10,
                WhiteRooks = 0x00_00_00_00_00_00_00_80,
                BlackRooks = 0x20_00_00_00_00_00_00_00
            };

            var position = new Position(board, Side.White, null, CastlingRights.WhiteKingSide, 0);
            var moves    = new List <Move>();

            // Act
            MoveGenerator.AddCastlingMoves(position, moves);

            // Assert
            moves.Should().BeEmpty();
        }
示例#3
0
        public void GeneratesCastlingMovesWhenAvailable()
        {
            // Assemble
            var board = new Board
            {
                WhiteKing  = 0x00_00_00_00_00_00_00_10,
                WhiteRooks = 0x00_00_00_00_00_00_00_81
            };

            var position = new Position(board, Side.White, null, CastlingRights.WhiteBoth, 0);
            var moves    = new List <Move>();

            // Act
            MoveGenerator.AddCastlingMoves(position, moves);

            // Assert
            var expectedMoves = new List <Move>
            {
                new Move(Square.e1, Square.g1, MoveFlags.KingCastle),
                new Move(Square.e1, Square.c1, MoveFlags.QueenCastle),
            };

            moves.Should().BeEquivalentTo(expectedMoves);
        }
 public void GetCastlingMoves() => MoveGenerator.AddCastlingMoves(_position, new List <Move>());