games: the clock beats the walk button, and the rack isn't betting
The trivia ladder handled a walk before it looked at the clock, so the timeout only ever bit if the browser volunteered it. Sit on a question, look it up, answer if you find it and walk if you don't, and you never lose a ladder. The clock is now the first thing that happens to a move. The house's chip rack was wired up as bet buttons on blackjack and hangman: it's four spans with data-chip on them and nothing said the handler only wanted the real ones. Clicking the house's money raised your bet. Hangman had two definitions of "a letter you'd guess" — unicode in the engine, ASCII in the renderer — and a phrase with an accent in it would have had no tile to fill and no key to fill it with. One definition now. Plus: trivia's countdown no longer freezes at zero when the server turns down a timeout report it was early for, questions whose wrong answer decodes into the right one are dropped at the door, and hangman bets on PeteFX's spot like every other table instead of its own copy of it.
This commit is contained in:
@@ -241,19 +241,6 @@ func ApplyMove(s State, m Move, now time.Time) (State, []Event, error) {
|
||||
}
|
||||
s = s.clone()
|
||||
|
||||
if m.Walk {
|
||||
// You cannot walk off a rung you haven't climbed. If you could, seeing the
|
||||
// first question and walking away would be a free look: stake, peek, walk,
|
||||
// stake again, and keep reshuffling until the question is one you know.
|
||||
// The first question is therefore the price of sitting down.
|
||||
if s.Rung == 0 {
|
||||
return s, nil, ErrNothingBanked
|
||||
}
|
||||
evs := []Event{}
|
||||
s.settle(OutcomeWalked, &evs)
|
||||
return s, evs, nil
|
||||
}
|
||||
|
||||
q := s.Live()
|
||||
if len(q.Answers) == 0 {
|
||||
return s, nil, ErrUnknownMove
|
||||
@@ -264,12 +251,31 @@ func ApplyMove(s State, m Move, now time.Time) (State, []Event, error) {
|
||||
// Out of time. This is a loss, and it has to be — a timeout that merely cost
|
||||
// you the speed bonus would make "leave it open in another tab and go and
|
||||
// look it up" the strongest way to play.
|
||||
//
|
||||
// It is checked before *everything*, walking included. A dead clock that you
|
||||
// could still walk away from would be no clock at all: you would sit on every
|
||||
// question for as long as you liked, answer the ones you found and walk off
|
||||
// the ones you didn't, and never once lose the ladder. The timeout has to be
|
||||
// the first thing that happens to a move, or it is not a deadline.
|
||||
if elapsed > s.Tier.Clock() {
|
||||
evs := []Event{{Kind: "timeout", Choice: -1, Correct: q.Correct}}
|
||||
s.settle(OutcomeTimeout, &evs)
|
||||
return s, evs, nil
|
||||
}
|
||||
|
||||
if m.Walk {
|
||||
// You cannot walk off a rung you haven't climbed. If you could, seeing the
|
||||
// first question and walking away would be a free look: stake, peek, walk,
|
||||
// stake again, and keep reshuffling until the question is one you know.
|
||||
// The first question is therefore the price of sitting down.
|
||||
if s.Rung == 0 {
|
||||
return s, nil, ErrNothingBanked
|
||||
}
|
||||
evs := []Event{}
|
||||
s.settle(OutcomeWalked, &evs)
|
||||
return s, evs, nil
|
||||
}
|
||||
|
||||
if m.Choice < 0 || m.Choice >= len(q.Answers) {
|
||||
return s, nil, ErrUnknownMove
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user