alexobviously / bishop

A chess logic package for Dart with flexible variant support
https://pub.dev/packages/bishop
Other
19 stars 8 forks source link

After a chess rook move from the h column, castling is impossible. #9

Closed malaschitz closed 1 year ago

malaschitz commented 1 year ago
import 'package:bishop/bishop.dart' as bishop;

void main() {
  bishop.Game game = bishop.Game(variant: bishop.Variant.standard());
  game.makeMoveString('a2a4');
  game.makeMoveString('e7e6');
  game.makeMoveString('a1a3');
  game.makeMoveString('d7d6');
  game.makeMoveString('a3h3');
  game.makeMoveString('c7c6');
  print(game.fen); // rnbqkbnr/pp3ppp/2ppp3/8/P7/7R/1PPPPPPP/1NBQKBNR w Kkq - 0 4
  game.makeMoveString('h3a3');
  print(game.fen); // rnbqkbnr/pp3ppp/2ppp3/8/P7/R7/1PPPPPPP/1NBQKBNR b kq - 1 4
}
malaschitz commented 1 year ago

A new bug. If I move a rook that was on a1 to the h column and it is taken there, the castling option is cancelled. In this exceptional situation, only the column is checked.

malaschitz commented 1 year ago

Solved in https://github.com/alexobviously/bishop/commit/db4fbdf618f444bbc684f29278a67454a0292add

alexobviously commented 1 year ago

Fixed in https://github.com/alexobviously/bishop/commit/00f4d98361bdd470f74943cb3075d3168c106761