关于「实证闭环:娱乐止损计算器、风险告知文案与预注册证伪方案」,《百家乐边际、算牌与破产》给出的定量结论是什么?

结论:第八章给出命令行小工具「娱乐止损计算器」、风险告知流程与预注册检验方案。书中以标注框区分已发表的证据、可运行的 Python 计算(21 段程序)、原典与作者的假说。

数据口径:本书只做概率与破产分析,不鼓励任何赌博,不教任何博彩技巧,不推荐任何场所或平台;书中参数为示意,全部计算由书中程序生成;书中内容是非个人化理财建议。 第二章计算移牌效应、模拟整副牌靴并重做小牌堆实验:押庄为正期望的局只占 0.00286,完美信息观察者每一百局只得 0.0014 个单位。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库

budget stake hourscoupsE[cost]P(stop line)cost/hour
200101.5909.450.03426.30
500251.06015.850.007415.85
10052.01206.230.07143.12
cost per coup at any stake = stake x 0.010579
查看完整验算程序
# Chapter 8. p82: The core of the Entertainment Stop-Loss Calculator
# (distill/tool.py), run on three illustrative profiles. Money is
# converted to units by the stake per coup; the hard stop line is the
# whole budget; the time limit becomes a coup limit at 60 coups an hour;
# plan() is the exact model of p62. Printed per profile: the expected
# cost, the chance the stop line ends the session first, and the cost
# per hour, which is the price of the entertainment. Profiles are
# examples, not recommendations.
import math


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 plan(budget, cap, win_stop, side, pb, pp, pt, mark=None):
    # 预算 budget 单位、每局 1 单位、最多 cap 局、赢够 win_stop 收手
    # (0 表示不设)。以二十分之一单位为格点,逐局推进分布。
    # mark:另报「净输超过 mark 单位」的概率。
    up = 19 if side == "B" else 20
    pw, pl = (pb, pp) if side == "B" else (pp, pb)
    start = 20 * budget
    top = start + 20 * win_stop if win_stop else None
    live = {start: 1.0}
    final = {}
    hit_stop, hit_win, played = [], [], []
    for k in range(cap):
        played.append(math.fsum(live.values()))
        new = {}
        for x in sorted(live):
            m = live[x]
            for y, pr in ((x + up, pw), (x - 20, pl), (x, pt)):
                new[y] = math.fsum((new.get(y, 0.0), m * pr))
        live = {}
        for y in sorted(new):
            if y < 20:
                hit_stop.append(new[y])
                final[y] = math.fsum((final.get(y, 0.0), new[y]))
            elif top is not None and y >= top:
                hit_win.append(new[y])
                final[y] = math.fsum((final.get(y, 0.0), new[y]))
            else:
                live[y] = new[y]
    for y in sorted(live):
        final[y] = math.fsum((final.get(y, 0.0), live[y]))
    nets = sorted((y - start) / 20 for y in final)
    mean = math.fsum(final[y] * (y - start) / 20 for y in sorted(final))
    cum, q90 = [], 0.0
    for y in sorted(final):
        cum.append(final[y])
        if math.fsum(cum) >= 0.1:
            q90 = (y - start) / 20
            break
    mk = budget if mark is None else mark
    over = [final[y] for y in sorted(final) if (start - y) > 20 * mk]
    return {"p_mark": math.fsum(over), "p_stop": math.fsum(hit_stop),
            "p_win": math.fsum(hit_win), "p_cap": math.fsum(live.values()),
            "mean": mean, "coups": math.fsum(played), "loss90": -q90,
            "worst": -nets[0]}


if __name__ == "__main__":
    wb, wp, wt = tally([128] + [32] * 9)
    d = wb + wp + wt
    pb, pp, pt = wb / d, wp / d, wt / d
    print("budget stake hours  coups  E[cost]  P(stop line)  cost/hour")
    for budget, stake, hours in ((200, 10, 1.5), (500, 25, 1.0),
                                 (100, 5, 2.0)):
        units = budget // stake
        cap = int(round(hours * 60))
        r = plan(units, cap, 0, "B", pb, pp, pt)
        cost = -r["mean"] * stake
        print("%6d %5d %5.1f  %5d  %7.2f   %.4f       %6.2f" % (
            budget, stake, hours, cap, cost, r["p_stop"], cost / hours))
    print("cost per coup at any stake = stake x %.6f" % (
        (20 * wp - 19 * wb) / (20 * d)))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《百家乐庄闲边际精确枚举、算牌无效性与赌徒破产概率母典》第 8 章「实证闭环:娱乐止损计算器、风险告知文案与预注册证伪方案」(版本 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}
}

本书其他章节结论