solitaire: detect a won board and finish it in one press

A drained, all-face-up board is a guaranteed clear that auto() sweeps home
in a single cascade, but the only way to trigger it was double-clicking
thirty cards home by hand. Add State.Won(), surface it in the view, and
swap the ordinary controls for one pulsing finish button when it's true.
This commit is contained in:
prosolis
2026-07-15 18:50:43 -07:00
parent 8504c4f47a
commit b814f936a8
7 changed files with 115 additions and 3 deletions

View File

@@ -60,6 +60,7 @@ type solitaireView struct {
Passes int `json:"passes"` // through the stock, counting this one; -1 unlimited
Moves int `json:"moves"`
CanAuto bool `json:"can_auto"`
Won bool `json:"won"` // every card face up, stock and waste empty: one press finishes it
Home int `json:"home"` // cards on the foundations
PerCard float64 `json:"per_card"` // what one more is worth
@@ -86,6 +87,7 @@ func viewSolitaire(g klondike.State) solitaireView {
Passes: g.PassesLeft(),
Moves: g.Moves,
CanAuto: g.CanAuto(),
Won: g.Won(),
Home: g.Home(),
PerCard: g.PerCard(),
BreakEven: g.Tier.BreakEven(),