Workshop › Blackjack › Step 15 of 22
The dealer has no choices: below 17 they draw, at 17 or more they stand, and then the round is finished. To make it feel like a real table, each of the dealer's moves waits half a second (30 frames).
```js
const DELAY = 30 // frames between the dealer's cards
let timer
timer = DELAY
function update() {
if (phase !== 'dealer') return
timer -= 1
if (timer > 0) return
// The dealer has no choice: draw below 17, stand on 17 or more.
if (handValue(dealer) < 17) {
dealer.push(nextCard())
timer = DELAY
} else finish()
}
update()
```timer counts down frames; the dealer acts only when it reaches 0.finish compares and pays.BET, write DELAY; under bet, write timer; in stand, set the timer.press, write update.loop, call update() before draw().Skills: Game states, The game loop