Skip to content

Blackjack Math Specification

Card Valuation

CardValue
2-9Face value (2-9)
10, J, Q, K10
A1 or 11 (soft)

Hand Scoring

A hand's score is the best valid total less than or equal to 21. Aces contribute either 1 or 11, whichever produces the best valid score.

Definitions

TermDefinition
Soft HandContains at least one Ace counted as 11 (e.g., A+7 = soft 18)
Hard HandAll Aces counted as 1, or no Aces present (e.g., K+7 = hard 17)
BustAll possible scores exceed 21 (e.g., K+Q+5 = 25)
Natural BlackjackExactly 2 cards: Ace + 10-value card

Scoring Algorithm

text
total_without_aces = sum of all non-Ace card values
ace_count = number of Aces in hand
base = total_without_aces + ace_count       (all Aces = 1)

FOR each Ace:
    IF base + 10 <= 21:
        base += 10   (count one Ace as 11)
        soft = true

score = base
bust = (total_without_aces + ace_count) > 21

Examples:

HandCalculationScoreSoft?Bust?
K♠ + 7♦10 + 717NoNo
A♥ + 7♣1+7=8 -> +10->1818YesNo
A♣ + K♥ + A♦10+1+1=12 -> +10->22(bust)->1212NoNo
K♠ + Q♦ + 5♥10+10+5=2525NoYes

State Machine

text
DEALING -> [Natural BJ?] -> Completed
       -> [Insurance?] -> InsuranceDecision -> PlayerTurn
       -> PlayerTurn
           |-> HIT (loop until bust/21/stand)
           |-> STAND -> DealerTurn -> Completed
           |-> DOUBLE -> DealerTurn -> Completed
           |-> SPLIT -> SplitTurn -> DealerTurn -> Completed

State Definitions

StateDescription
DealingInitial 4-card deal from provably fair deck
InsuranceDecisionDealer shows Ace, player decides whether to take insurance
PlayerTurnPlayer may: Hit, Stand, Double, Split
SplitTurnTwo independent hands played sequentially
DealerTurnDealer draws to completion per fixed drawing rules
CompletedGame resolved, winnings calculated

Dealer Drawing Rules

The dealer is fully automated and follows fixed, non-discretionary rules with no decision-making capability:

text
WHILE true:
    IF score.is_bust                -> STOP (dealer busts)
    IF score.value > 17             -> STOP (stand)
    IF score.value == 17:
        IF score.is_soft AND config.hits_soft_17:
            draw_card() -> CONTINUE
        ELSE:
            STOP (stand)
    IF score.value < 17:
        draw_card() -> CONTINUE
RuleValue
Hit thresholdscore <= 16
Stand thresholdscore >= 17
Hit Soft 17Configurable (default: false)

Split Rules

Eligibility

  • Exactly 2 cards in hand
  • Both cards share the same value (e.g., 8+8, K+Q, A+A)

Execution

  1. Separate the pair into two independent hands
  2. Deal one new card to each hand (from positions 5 and 6)
  3. Duplicate the bet: bet_1 = bet_2 = original bet
  4. Player plays each hand sequentially

Split Aces Rule

When Aces are split:

  • Each Ace receives exactly one additional card
  • The hand immediately stands, no further actions allowed
  • Split Aces do NOT qualify for natural blackjack (pay 1:1, not 3:2)
  • Double After Split is never allowed on split Aces

Double After Split (DAS)

Controlled by allow_double_after_split configuration flag.

DAS SettingDouble on Split HandDouble on Split Aces
false (default)Not allowedNot allowed
trueAllowed (if balance >= bet)Never allowed

Payout Multipliers

OutcomeMultiplierFormulaExample ($100 bet)
Natural Blackjack2.5×win = bet × 2.5$250
Standard Win2.0×win = bet × 2.0$200
Push (tie)1.0×win = bet × 1.0$100 (returned)
Insurance Win3.0×win = ins_bet × 3.0$150 on $50 ins
Losewin = 0$0

Configurable Parameters

ParameterDefaultDescription
blackjack_multiplier2.5Natural blackjack payout
win_multiplier2.0Standard win payout
insurance_multiplier3.0Insurance win payout
dealer_hits_soft_17falseDealer behavior on soft 17
allow_double_after_splitfalseDAS rule