feat: Show solution — winning_line core API + auto-playback (card_game bucket 4) #159
Reference in New Issue
Block a user
Delete Branch "feat/solution-line"
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?
Puts the previously unused
Solution::clean_solution()to work as a player-facing feature.Core —
GameState::winning_line(moves_budget, states_budget): budgeted throwaway-session solve (mirrors the hint path), cleaned viaclean_solution(),is_uselessmoves stripped, and the stripped line is verified by pure replay (falls back to the unstripped line if stripping ever broke it). Contract: a returned line always replays to a win viaapply_instruction. 4 new tests; 57 core tests green.Engine —
SolutionPlaybackPlugin: visible "Show solution" button in the pause modal (§3.3), solves off-thread onAsyncComputeTaskPoolwith stale-result protection, then steps the line at 0.45s/move through the normalMoveRequestEvent/DrawRequestEventpipeline —GameStateResourcestays the only mutator. Cancels on Esc/pause/undo/new-game/MoveRejectedEvent; toasts for searching/found/unwinnable/budget-exhausted. 4 headless tests incl. a full request→solve→auto-play→win end-to-end; engine 917/917, workspace green, clippy-D warnings, fmt.Follow-up candidates (not in this PR): progress indicator during long solves; decide whether Esc should be swallowed during playback instead of also opening pause. Note: the pre-existing
winnable_verdict_carries_a_first_movetest is vacuous (passes on solver error) — filing separately.🤖 Generated with Claude Code