What does Baccarat Edges, Counting and Ruin conclude, in numbers, about “The Road Has No Predictive Power: Streak Lengths, Runs Tests and Small-Sample Bias”?

Answer: Chapter 5 tests the road on two thousand really dealt shoes; the runs test rejects in a share of 0.0480, as expected without any signal, and the within-scorecard share of Banker after three Bankers averages only 0.4502, a small-sample bias.

Scope of the numbers: Its parameters are illustrative, all calculations are generated by its programs, and nothing in it is personalised financial advice. Marked boxes separate published evidence, runnable Python calculations (21 programs), classical sources and the author's hypotheses.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.0480

decided coups 148591 in 2000 shoes, P(B)0.5077
k P(B | k B in a row) n P(B | k P in a row) n
10.5063 74437 0.5095 72154
20.5094 37205 0.5095 34919
30.5089 18704 0.5124 16881
40.5140 9396 0.5149 8105
50.5117 4772 0.5168 3866
P(same as previous)0.4986, expected if independent 0.5001
runs test, share of shoes with |z| > 1.960.0480
mean z over shoes: +0.0284
Show the full program
# Chapter 5. p52: Does the scoreboard predict the next coup? Seeded deal
# of 2,000 real eight-deck shoes by the drawing rules (cards without
# replacement, cut 14 cards from the end, as in p22). Ties are removed,
# as a streak-reading bettor removes them. Reported: the pooled chance of
# Banker after k Banker results in a row and after k Player results in
# a row, the lag-one correlation of decided results, and the share of
# shoes whose Wald-Wolfowitz runs test rejects randomness at the 5 %
# level (about 0.05 is expected if the road carries no signal).
import math
import random


def banker_draws(b, p3):
    # 庄家补牌表:b 为庄两张牌点数,p3 为闲第三张牌点数
    if b <= 2:
        return True
    if b == 3:
        return p3 != 8
    if b == 4:
        return 2 <= p3 <= 7
    if b == 5:
        return 4 <= p3 <= 7
    if b == 6:
        return p3 in (6, 7)
    return False


DRAW = [[banker_draws(b, p3) for p3 in range(10)] for b in range(10)]
# WIN[p][b]:0 庄胜,1 闲胜,2 和
WIN = [[0 if b > p else 1 if p > b else 2 for b in range(10)]
       for p in range(10)]


def tally(c):
    # 返回 [庄胜, 闲胜, 和] 的整数权重,分母为 n 起连乘六项的降阶乘
    c = list(c)
    n = 0
    for x in c:
        n += x
    s4, s5 = (n - 4) * (n - 5), n - 5
    acc = [0, 0, 0]
    vals = range(10)
    for p1 in vals:
        w1 = c[p1]
        if not w1:
            continue
        c[p1] -= 1
        for b1 in vals:
            w2 = w1 * c[b1]
            if not w2:
                continue
            c[b1] -= 1
            for p2 in vals:
                w3 = w2 * c[p2]
                if not w3:
                    continue
                c[p2] -= 1
                pt = (p1 + p2) % 10
                for b2 in vals:
                    w4 = w3 * c[b2]
                    if not w4:
                        continue
                    c[b2] -= 1
                    bt = (b1 + b2) % 10
                    if pt >= 8 or bt >= 8 or (pt >= 6 and bt >= 6):
                        acc[WIN[pt][bt]] += w4 * s4
                    elif pt <= 5:
                        drw = DRAW[bt]
                        for p3 in vals:
                            w5 = w4 * c[p3]
                            if not w5:
                                continue
                            pf = (pt + p3) % 10
                            row = WIN[pf]
                            if drw[p3]:
                                c[p3] -= 1
                                for b3 in vals:
                                    acc[row[(bt + b3) % 10]] += w5 * c[b3]
                                c[p3] += 1
                            else:
                                acc[row[bt]] += w5 * s5
                    else:
                        row = WIN[pt]
                        w = w4 * s5
                        for b3 in vals:
                            acc[row[(bt + b3) % 10]] += w * c[b3]
                    c[b2] += 1
                c[p2] += 1
            c[b1] += 1
        c[p1] += 1
    return acc


def play(cards, i):
    # 按补牌规则发一局,返回 (结果, 用掉的张数)
    p = (cards[i] + cards[i + 2]) % 10
    b = (cards[i + 1] + cards[i + 3]) % 10
    j = i + 4
    if not (p >= 8 or b >= 8 or (p >= 6 and b >= 6)):
        if p <= 5:
            p3 = cards[j]
            j += 1
            p = (p + p3) % 10
            if DRAW[b][p3]:
                b = (b + cards[j]) % 10
                j += 1
        else:
            b = (b + cards[j]) % 10
            j += 1
    return ("B" if b > p else "P" if p > b else "T"), j - i


def runs_z(seq):
    n1 = seq.count("B")
    n2 = len(seq) - n1
    if n1 == 0 or n2 == 0:
        return 0.0
    runs = 1
    for a, b in zip(seq, seq[1:]):
        runs += a != b
    n = n1 + n2
    mu = 2 * n1 * n2 / n + 1
    var = 2 * n1 * n2 * (2 * n1 * n2 - n) / (n * n * (n - 1))
    return (runs - mu) / math.sqrt(var)


if __name__ == "__main__":
    rng = random.Random(20261112)
    deck = []
    for r in range(10):
        deck += [r] * (128 if r == 0 else 32)
    shoes = []
    for _ in range(2000):
        rng.shuffle(deck)
        i, seq = 0, []
        while 416 - i >= 14:
            res, used = play(deck, i)
            i += used
            if res != "T":
                seq.append(res)
        shoes.append(seq)
    tot = 0
    nb = 0
    after = {}
    pairs = same = 0
    for seq in shoes:
        tot += len(seq)
        nb += seq.count("B")
        for j in range(1, len(seq)):
            pairs += 1
            same += seq[j] == seq[j - 1]
            for k in range(1, 6):
                if j >= k:
                    last = seq[j - k:j]
                    for s in "BP":
                        if last == [s] * k:
                            h = after.setdefault((s, k), [0, 0])
                            h[0] += 1
                            h[1] += seq[j] == "B"
    pb = nb / tot
    print("decided coups %d in 2000 shoes, P(B) = %.4f" % (tot, pb))
    print(" k   P(B | k B in a row)   n      P(B | k P in a row)   n")
    for k in range(1, 6):
        a, b = after[("B", k)], after[("P", k)]
        print("%2d        %.4f       %6d        %.4f        %6d" % (
            k, a[1] / a[0], a[0], b[1] / b[0], b[0]))
    q = 1 - pb
    exp_same = pb * pb + q * q
    print("P(same as previous) = %.4f, expected if independent %.4f" % (
        same / pairs, exp_same))
    zs = [runs_z(s) for s in shoes]
    rej = len([z for z in zs if abs(z) > 1.96]) / len(zs)
    print("runs test, share of shoes with |z| > 1.96: %.4f" % rej)
    print("mean z over shoes: %+.4f" % (math.fsum(zs) / len(zs)))

Single source and citation

Fan, Y. (2026). Exact Enumeration of Baccarat House Edges, the Futility of Card Counting and Gambler's Ruin Probabilities (Version 1.0.0), Chapter 5: The Road Has No Predictive Power: Streak Lengths, Runs Tests and Small-Sample Bias. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-224 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026224,
  author    = {Fan, Yafu},
  title     = {Exact Enumeration of Baccarat House Edges, the Futility of Card Counting and Gambler's Ruin Probabilities},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book