Fix: Pawns on edge ranks should have no chess.moves()#578
Conversation
98f7eb5 to
9bb38a3
Compare
|
I'm not sure whether to merge this yet, as a pawn on h8 is not a legal position. It maybe better to tighten up / change the way the board can be set up. |
|
Depends on how strictly you'd like to lock the library down to modern chess rules. There are fringe regimes such as the British Chess Association "dead pawn" rule, and the Burmese Chess promotion rules, under which a pawn can legally occupy the promotion square: https://en.wikipedia.org/wiki/Promotion_%28chess%29 You'll want to reconcile the chosen policy with I'm prototyping a rules-free software chess set mimicking a physical board & pieces, where it's in line with the concept to allow such positions: https://shah-baby.netlify.app. It'd be nice if I could still use chess.js for state management. |
Closes #577
Pawn on H8 throws a BigInt error when asked about
chess.moves({ square: 'h8' })