fix(engine): double-click moves exactly the clicked run (#158) #167

Merged
funman300 merged 1 commits from fix/158-double-click-exact-stack into master 2026-07-09 21:58:16 +00:00
Owner

Fixes #158.

Double-click/tap auto-move previously tried the run's top card alone before the full run headed by the clicked card, so a top card with a foundation move hijacked the intended whole-stack move.

Changes:

  • New shared helper auto_move_for_run: the move always covers exactly the run from the clicked/tapped card — a lone top card goes foundation-first, a multi-card run moves whole to a tableau or not at all (rejected with sound + shake).
  • handle_double_click (mouse) and handle_double_tap (touch) both route through it; the duplicated priority blocks are gone.
  • The double-click key is now the clicked card, so two quick clicks on different cards of the same stack no longer register as a double-click.
  • Regression tests against real dealt positions (seeds 51/145) where the run's top card is foundation-eligible bait: whole-run move taken, no top-card fallback for immovable runs, foundation preference kept for lone cards.

cargo test --workspace (931 engine tests) and cargo clippy --workspace -- -D warnings are clean.

🤖 Generated with Claude Code

Fixes #158. Double-click/tap auto-move previously tried the run's **top card alone** before the full run headed by the clicked card, so a top card with a foundation move hijacked the intended whole-stack move. Changes: - New shared helper `auto_move_for_run`: the move always covers exactly the run from the clicked/tapped card — a lone top card goes foundation-first, a multi-card run moves whole to a tableau or not at all (rejected with sound + shake). - `handle_double_click` (mouse) and `handle_double_tap` (touch) both route through it; the duplicated priority blocks are gone. - The double-click key is now the clicked card, so two quick clicks on *different* cards of the same stack no longer register as a double-click. - Regression tests against real dealt positions (seeds 51/145) where the run's top card is foundation-eligible bait: whole-run move taken, no top-card fallback for immovable runs, foundation preference kept for lone cards. `cargo test --workspace` (931 engine tests) and `cargo clippy --workspace -- -D warnings` are clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
funman300 added 1 commit 2026-07-09 19:56:35 +00:00
fix(engine): double-click moves exactly the clicked run (#158)
Test / test (pull_request) Successful in 36m48s
adbcb8f59a
Double-click/tap auto-move previously tried the run's top card alone
before the full run headed by the clicked card, so a top card with a
foundation move hijacked the intended whole-stack move. Both handlers
now share auto_move_for_run: a lone top card goes foundation-first, a
multi-card run moves whole to a tableau or not at all. The double-click
key is now the clicked card, so two clicks on different cards of the
same stack no longer register as a double-click.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
funman300 merged commit dda6a25439 into master 2026-07-09 21:58:16 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#167