diff options
Diffstat (limited to 'internal/casino/blackjack.go')
| -rw-r--r-- | internal/casino/blackjack.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/casino/blackjack.go b/internal/casino/blackjack.go index 442d4a2..4901c31 100644 --- a/internal/casino/blackjack.go +++ b/internal/casino/blackjack.go @@ -214,6 +214,9 @@ func (t *blackjackTable) tick() []Event { } active.hands[t.activeHand].stood = true events := []Event{t.private(name, "Your action timed out; standing.")} + // Restart the timer so the next active hand gets a full action window + // instead of timing out on the following tick. + t.timer.start(t.Rules.ActionTicks) events = append(events, t.finishHand()...) return events default: @@ -232,7 +235,8 @@ func (t *blackjackTable) action(name, action string) []Event { } p := t.players.get(name) hand := p.hands[t.activeHand] - t.timer.start(t.Rules.ActionTicks) + // The action window only restarts when a new turn is actually prompted + // (see prompt()); a rejected command can no longer stall the table. switch action { case "hit": if fromSplitAces(hand) { @@ -421,6 +425,9 @@ func (t *blackjackTable) beginPlay() { } func (t *blackjackTable) prompt() []Event { + // Every freshly-prompted turn gets a full action window; rejected inputs + // and timeouts can never extend the deadline. + t.timer.start(t.Rules.ActionTicks) name := t.activeName() if name == "" { return t.settle() |
