ChessLib
ChessLib copied to clipboard
Position.IsLegal(Move) returns true for many moves that are not legal
Perhaps there's a different endpoint I should be using to determine whether a move is legal. But when developing a UI with this library, I need a way to determine whether a player-input move is legal. This function sounds like the right one, however it only checks for specific illegal moves- it doesn't check for instance whether the position the piece is moving to is within its capabilities. For instance, I can move a pawn sideways.
I would expect the following test to pass:
public void MoveIsLegal()
{
var illegalMove = Move.Create(Square.F2, Square.F6);
// construct game and start a new game
var game = GameFactory.Create(Fen.Fen.StartPositionFen);
var position = game.Pos;
var state = new State();
// verify in check is actually true
Assert.False(position.IsLegal(illegalMove));
}