dartchess
dartchess copied to clipboard
Bug in Castling?
Hi,
Library Version: dartchess: ^0.6.1
I am using the following test-code to query the allowed moves of the king:
String fen =
"rnbqk2r/ppppbppp/4p1N1/4P3/8/B7/PPPPBPPP/RN1QK2R w KQkq - 0 1";
final chess = Chess.fromSetup(Setup.parseFen(fen));
SquareSet set = chess.legalMovesOf(Squares.e1);
for (var element in set.squares) {
developer.log(element.toString());
}
Iterable<Square> squares = set.squares;
expect(squares.length, 2);
expect(squares.first, Squares.f1);
expect(squares.last, Squares.g1);
Expected: King has two fields, f1 and g1 (in case of castling). Problem: legalMovesOf gives back the fields f1 and h1, which seems to be odd?
When executing a move, it is possible to execute the move chess.play(NormalMove(from: Squares.e1, to: Squares.g1));
, which again seems to be odd, as g1 is not recognized as a legal move.
Best Regards, Tobias