Exemple #1
0
        public void GeneratesCorrectKingMovesWhite()
        {
            // Assemble
            var position = Position.FromFENString("4k3/3Pn3/8/8/8/8/6PP/5PK1 w - - 1 8 ");
            var moves    = new List <Move>();

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

            // Assert
            var expectedMoves = new List <Move>
            {
                new Move(Square.g1, Square.h1, MoveFlags.QuietMove),
                new Move(Square.g1, Square.f2, MoveFlags.QuietMove)
            };

            moves.Should().BeEquivalentTo(expectedMoves);
        }
Exemple #2
0
        public void GeneratesCorrectKingMovesBlack()
        {
            // Assemble
            var position = Position.FromFENString("4k3/3Pn3/8/8/8/8/6PP/5PK1 b - - 1 8 ");
            var moves    = new List <Move>();

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

            // Assert
            var expectedMoves = new List <Move>
            {
                new Move(Square.e8, Square.d7, MoveFlags.Capture, Piece.Pawn),
                new Move(Square.e8, Square.f7, MoveFlags.QuietMove),
                new Move(Square.e8, Square.d8, MoveFlags.QuietMove),
                new Move(Square.e8, Square.f8, MoveFlags.QuietMove)
            };

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