Workshop › Blackjack › Step 16 of 22

The next round

What we are doing

When a round is over, N or Space deals the next one. A deck running low (under 15 cards) is replaced by a fresh shuffled one. If you can't pay the bet any more, the round says so, and the next deal starts you over with 100 chips.

```js
if (bank < BET) bank = START // out of chips: start over
if (deck.length < 15) newDeck()

if (bank < BET) message += ' - out of chips!'

else if (button === 'Deal' && phase === 'done') deal()
```

What it means

Your turn

  1. At the top of deal, start over when out of chips and replace a low deck.
  2. At the end of finish, add the out-of-chips note.
  3. In press, deal when the round is done.

Skills: Game states

All steps

  1. Cards
  2. A deck
  3. Shuffle
  4. Deal
  5. Cards on the table
  6. Card faces
  7. Keep drawing
  8. What is a hand worth?
  9. Aces: 11 or 1
  10. Hit: one more card
  11. Stand
  12. The hidden card
  13. Chips
  14. Who wins?
  15. The dealer's turn
  16. The next round
  17. Blackjack!
  18. Your record
  19. Double down
  20. Long hands fit
  21. Buttons
  22. Build it yourself: six decks