关于「算牌为什么几乎无效:移牌效应、牌靴模拟与计牌基本定理」,《百家乐边际、算牌与破产》给出的定量结论是什么?
结论:第二章计算移牌效应、模拟整副牌靴并重做小牌堆实验:押庄为正期望的局只占 0.00286,完美信息观察者每一百局只得 0.0014 个单位。
数据口径:本书只做概率与破产分析,不鼓励任何赌博,不教任何博彩技巧,不推荐任何场所或平台;书中参数为示意,全部计算由书中程序生成;书中内容是非个人化理财建议。 第二章计算移牌效应、模拟整副牌靴并重做小牌堆实验:押庄为正期望的局只占 0.00286,完美信息观察者每一百局只得 0.0014 个单位。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 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 |
查看完整验算程序
# 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))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《百家乐庄闲边际精确枚举、算牌无效性与赌徒破产概率母典》第 2 章「算牌为什么几乎无效:移牌效应、牌靴模拟与计牌基本定理」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 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}
}