You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IsCapture is not set when an en passant move is manually constructed.
This seems to be because the underlying MoveHelper.CreateMoveFromName(...) method doesn't set the captureType for en passant moves.
Here is an example from the test below.
Since EnPassant is true, IsCapture should also be true but it is not.
The result is that a manually created EP Move instance does not match what the move generator produces
because Move.Equals says they are different.
Here is a xUnit test:
[Fact]publicvoidEnPassantTest(){varinternalBoard=new ChessChallenge.Chess.Board();
internalBoard.LoadPosition("1q5k/8/8/3pP3/8/6K1/8/8 w - d6 2 4");varboard=new Board(internalBoard);varmoves= board.GetLegalMoves();// Expect to find e5d6 (EP move)varexpected=new Move("e5d6", board);// BUG: This constructor fails to set captureType correctly// This fails because "IsCapture" is not set correctly in 'expected'
Assert.Contains(expected, moves);}
The correctly generated Move from the move generator looks like this:
IsCapture is not set when an en passant move is manually constructed.
This seems to be because the underlying MoveHelper.CreateMoveFromName(...) method doesn't set the captureType for en passant moves.
Here is an example from the test below.
Since EnPassant is true, IsCapture should also be true but it is not.
The result is that a manually created EP Move instance does not match what the move generator produces
because Move.Equals says they are different.
Here is a xUnit test:
The correctly generated Move from the move generator looks like this:
Position used:
1q5k/8/8/3pP3/8/6K1/8/8 w - d6 2 4
cc @SebLague
The text was updated successfully, but these errors were encountered: