Workshop › Blackjack › Step 13 of 22

Chips

What we are doing

You play for chips. You start with 100, and every deal puts a bet of 10 on the table. reset starts a whole new game: full chips, a new deck, the first deal.

```js
const START = 100 // chips at the start
const BET = 10
let bank
let bet

  bet = BET
  bank -= bet

function reset() {
  bank = START
  newDeck()
  deal()
}

  ctx.fillText('Chips ' + bank + '  Bet ' + bet, 20, 28)

reset()
```

What it means

Your turn

  1. Under PLAYER_Y, write START and BET; under phase, write bank and bet.
  2. At the top of deal, place the bet.
  3. Above press, write reset; at the bottom, call it instead of newDeck() and deal().
  4. In draw, write the chips under your total.

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