Game.fromFen accepts positions the engine cannot play #433
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
spec
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
amaurycoudr/chess-project#433
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happens
Game.fromFenaccepts positions the engine cannot play, and they crash or corrupt it later. The front feedsGame.fromFenfrom storage (apps/front/src/local/stored-game.ts:42).Castling right with the king off its home square.
availableCastleschecks the rook but not the king (packages/engine/src/rules/castling.ts:102-114).En passant square never checked (
packages/engine/src/notation/fen.ts:168-177). Any square is accepted, so an en passant capture with no pawn behind it removes a phantom pawn, and the undo then adds one to the board (packages/engine/src/rules/search-board.ts:126-140,154-158).Side not to move in check is accepted, and returns legal moves.
Done when
parseFenrefuses each of these with its ownFenErrortype:Each refusal has a test, and the FEN above returns an error instead of a
Game.mentioned in commit
22c74fe34amentioned in merge request !545
mentioned in commit
bcc826d393