Skip to content

chess: premove a recapture onto the viewer's own piece - #463

Merged
aaylward merged 1 commit into
mainfrom
chess-premove-recapture
Oct 19, 2026
Merged

aaylward merged 1 commit into
mainfrom
chess-premove-recapture

Conversation

@aaylward

@aaylward aaylward commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Bug

Premoving a capture of an opponent's piece already worked. Premoving a recapture didn't. Off turn, the target square still holds your own piece (the one about to be taken), and a tap or drop there always picked that piece up instead.

Fix

rules.covers(piece, from, to) checks whether the piece can take on that square on an empty board (sliders aren't blocked). Off turn, on your own piece's square:

  • picked piece covers it → queue the premove (recapture)
  • picked piece doesn't cover it → pick that piece up (same as before)

This matches chessground. The hub still decides legality when your turn comes. README updated, since the client now reads piece geometry.

Tests

  • covers unit tests: each piece type, pawn direction, and moving to its own square.
  • Component tests: enemy capture (control), recapture by tap, recapture by drag, and dropping on an own piece the dragged one can't reach still picks it up.
  • Negative tests bite: with covers forced to true, both reselect tests fail.
  • typecheck, lint, the full test suite and build pass locally.
  • The four-agent review panel from WORKING_AGREEMENT did not run.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
muchq cc78e20 Commit Preview URL

Branch Preview URL
Oct 19 2026, 08:16 PM

Off turn, a tap or drop on a square holding the viewer's own piece always
picked that piece up, so the usual capture premove — retaking on a square
the opponent is about to capture on — could not be queued. Now it queues
when the picked piece covers that square on an empty board, and picks the
other piece up otherwise.
@aaylward
aaylward force-pushed the chess-premove-recapture branch from 341fc43 to cc78e20 Compare October 19, 2026 20:15
@aaylward
aaylward merged commit 7fe0f51 into main Oct 19, 2026
2 checks passed
@aaylward
aaylward deleted the chess-premove-recapture branch October 19, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants