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:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user