Every engine
03Engine

Blackjack

One player against the dealer: a fresh six-deck shoe each round, every card drawn when it is shown, dealer peeks, one split, no surrender, no insurance.

Kind
cards, against a dealer
Largest win
Set by the play, not by a table
Name in the files
blackjack
Version
e08710bf3cbe

Download this engine as one file

What the player sets

  • the rules follow the dial: what a blackjack pays (x100: 55, 67, 80, 93, 105, 118, 130 at 9600, 9650, ... 9900); the dealer stands on every 17; double on any two cards, and after a split

Every round also takes the return dial in basis points, 9600 to 9900, and a stake.

The round, in order

  1. the shoe is six decks: six copies of each card 0..51, 312 cards. The cards left are listed in rising order of card number, copies side by side. A plain draw is the card at place int_below(n), n being how many are left; it leaves the shoe
  2. at the start three plain draws, in this order: a card to the player, the dealer's open card, a second card to the player. The dealer's hidden card is not drawn
  3. the look: when the open card is ten-valued or an ace, one plain draw c is made at once. If c makes 21 with the open card, c is the hidden card: it is turned and the round ends, the stake coming back if the player has blackjack too, otherwise nothing. If not, c stays in the shoe and only "no blackjack" is kept: from here on the hidden card may not be an ace (under a ten-valued card) or ten-valued (under an ace)
  4. a player blackjack pays at once (the hidden card is then turned, as below)
  5. otherwise the player acts. A card dealt to the player while a looked-at hidden card lies on the table is a weighted draw: with n cards left, b of which the hidden card may be, card number x weighs (copies of x left) x (b - 1 if the hidden card may be x, else b). The weights add up to b x (n - 1): r = int_below(b x (n - 1)), and the card is found by going through the card numbers in rising order, taking each weight off r until r is smaller than the next. When the dealer did not look (open card two to nine) it is a plain draw
  6. when every hand is done the hidden card is turned: the card at place int_below(b) among the cards left that it may be, in rising order (all of them when the dealer did not look). The dealer's further cards are plain draws: if any hand is 21 or under, the dealer draws to 17
  7. a hand over 21 loses; a hand beating the dealer, or any live hand when the dealer is over 21, is paid 2 for each unit bet; an equal hand gets its bet back

int_below(m) is a whole number from 0 to m-1: limit = 2^64 - (2^64 mod m); take values until v < limit; return v mod m. shuffle: Fisher-Yates from the end, j = int_below(i+1). Words: HMAC-SHA256(key = seed, "STORM-DRBG|" || u64be(j)), cut into big-endian u64s.

What the player may do

  • hit
  • stand
  • double: one more card, the bet on that hand doubled (first two cards only)
  • split: two cards of one rank, or two ten-value cards that are not aces, once; split aces get one card each

What it pays

Why the weighted draw: in a shoe shuffled beforehand, once the dealer has looked and gone on, a card the hidden one cannot be (an ace, when a ten shows) is a little likelier to come to the player than the others, because none of its copies is under the hidden card. The weights give every card exactly that chance, so every round has the chance it had with a shoe shuffled at the start (engine/verify_draw_order.py lists every round both ways). The return depends on how the player plays. The dial points are the return under basic strategy, measured by engine/verify_blackjack.py and engine/verify_blackjack_dial.py; between two points the lower point's rules apply.

  • dial 9600: a blackjack pays 0.55 to 1
  • dial 9650: a blackjack pays 0.67 to 1
  • dial 9700: a blackjack pays 0.80 to 1
  • dial 9750: a blackjack pays 0.93 to 1
  • dial 9800: a blackjack pays 1.05 to 1
  • dial 9850: a blackjack pays 1.18 to 1
  • dial 9900: a blackjack pays 1.30 to 1

Tables

No table: the player decides during the round. What is paid follows from the steps above.

On Storm

In Storm’s core this engine is built from this page as written, with the settings and the largest win above, and is right when it reproduces the test rounds below. The rest of this part is about the templates Storm has live today, which is the way onto Storm until then.

Our reading against Storm’s templates: does not fit. The player decides during the round.

On the templates it would take: a card template. Storm lists it as not enabled.

Check a build against ours

72 whole rounds, each from a seed given in the file. A build is right when, from the same seed, settings, dial and actions, it makes the same draws in the same order and pays the same amount. The seed of a test round is sha256("rain-engine-vector|<engine>|<case>|<rtp_bps>|<i>"), given in hex in each vector.

basic strategy, dial 9900
seed 87ceec9f7356cfc0c3db5ab052567129b264b09f69f4b9b24a1965fbd436b011
settings {}
actions [["split"]]
draws int_below(312) = 307, int_below(311) = 179, int_below(310) = 150, int_below(309) = 100, int_below(308) = 209, int_below(307) = 173, int_below(306) = 137
pays 2x (payX10k 20000)
basic strategy, dial 9900
seed 7cf0f9336cc0e1ddb03ac3921c65d60c6bc6233bdff5a4f207edf98e5a434fe0
settings {}
draws int_below(312) = 100, int_below(311) = 73, int_below(310) = 149, int_below(309) = 133
pays 0x (payX10k 0)

The rest are in this engine’s file, with the full result of each round. The reference build plays this engine and reproduces every one of them.

Nothing hidden is fixed when a round starts: what a step shows is drawn at that step. So the same file holds 72 more rounds played with a seed of its own for the start and for every action after it, as a round runs where each step’s randomness is formed only after the player has acted. The rules are the same; only the generator is started afresh at each step.