What does Baccarat Edges, Counting and Ruin conclude, in numbers, about “Why Counting Barely Works: Effects of Removal, Simulated Shoes and the Fundamental Theorem”?
Answer: Chapter 2 computes effects of removal, simulates whole shoes and repeats the small-pack experiment: Banker has a positive expectation on only 0.00286 of coups, and an observer with perfect information gains only 0.0014 units per hundred coups.
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.0014, 0.00286
| shoes 200, coups 16448, recomputed exactly 577 | |
| Banker positive | 47 coups, rate 0.00286, mean edge 0.0027 |
| Player positive | 19 coups, rate 0.00116, mean edge 0.0056 |
| share of positive coups with < | 40 cards left: 0.924 |
| ideal observer, 1 unit only when positive: | |
| gain per 100 coups observed | 0.0014 units |
| flat Banker bettor, loss per 100 coups | 1.0579 units |
Show the full program
# Chapter 2. p22: How often does a real shoe turn in the bettor's favour?
# Seeded simulation of whole eight-deck shoes: shuffle 416 cards, deal
# coups by the drawing rules, stop starting coups once fewer than 14
# cards remain (an illustrative cut-card depth). Before each coup the
# remaining composition gives a linear estimate of each bet's EV from
# the effects of removal of p21; every coup whose estimate is above
# -0.004, and every coup dealt from 24 or fewer cards, is recomputed
# exactly. Counts and rates are reported for
# an idealised observer who knows the exact composition at all times.
import math
import random
from fractions import Fraction as F
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 ev(c):
wb, wp, wt = tally(c)
d = wb + wp + wt
return (19 * wb - 20 * wp) / (20 * d), (wp - wb) / d
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 banker_draws(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
if __name__ == "__main__":
full = [128] + [32] * 9
b0, p0 = ev(full)
eor = []
for r in range(10):
c = list(full)
c[r] -= 1
b, p = ev(c)
eor.append((b - b0, p - p0))
rng = random.Random(20261112)
deck = []
for r in range(10):
deck += [r] * full[r]
coups = checked = 0
pos = {"B": [], "P": []}
late = 0
for shoe in range(200):
rng.shuffle(deck)
i = 0
c = list(full)
while 416 - i >= 14:
n = 416 - i
dev = [F(full[r], 416) * n - c[r] for r in range(10)]
lb = b0 + 415 / n * math.fsum(
float(dev[r]) * eor[r][0] for r in range(10))
lp = p0 + 415 / n * math.fsum(
float(dev[r]) * eor[r][1] for r in range(10))
coups += 1
if n <= 24 or max(lb, lp) > -0.004:
checked += 1
eb, ep = ev(c)
for k, e in (("B", eb), ("P", ep)):
if e > 0:
pos[k].append(e)
late += n <= 40
res, used = play(deck, i)
for x in deck[i:i + used]:
c[x] -= 1
i += used
print("shoes 200, coups %d, recomputed exactly %d" % (coups, checked))
for k, name in (("B", "Banker"), ("P", "Player")):
v = pos[k]
m = math.fsum(v) / len(v) if v else 0.0
print("%s positive: %d coups, rate %.5f, mean edge %.4f" % (
name, len(v), len(v) / coups, m))
allpos = pos["B"] + pos["P"]
gain = math.fsum(allpos)
print("share of positive coups with <= 40 cards left: %.3f" % (
late / max(1, len(allpos))))
print("ideal observer, 1 unit only when positive:")
print(" gain per 100 coups observed = %.4f units" % (
100 * gain / coups))
print("flat Banker bettor, loss per 100 coups = %.4f units" % (
-100 * b0))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 2: Why Counting Barely Works: Effects of Removal, Simulated Shoes and the Fundamental Theorem. 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
- Chapter 1 · Exact Enumeration of the Eight-Deck Shoe: Where Banker 1.06 % and Player 1.24 % Come From
- Chapter 3 · Gambler's Ruin: a Finite Bankroll Against a House Without a Ceiling
- Chapter 4 · Staking Systems Cannot Change the Expectation: Doubling, d'Alembert and the Optional Stopping Theorem
- Chapter 5 · The Road Has No Predictive Power: Streak Lengths, Runs Tests and Small-Sample Bias
- Chapter 6 · The Price of a Session: Loss Distributions, a Hard Stop Line and Chasing
- Chapter 7 · Sources East and West: Tao Kan Throws the Gaming Pieces into the River, and Cardano's Book on Games of Chance
- Chapter 8 · Closing the Loop: the Entertainment Stop-Loss Calculator, Risk Notices and Pre-Registered Tests