5D Library › Imperfect-Information Stochastic Games, Bayesian Hand-Reading and Counterfactual Regret Minimisation in Four-Player Tile Dynamics · 中文
Chapter 2. The Tile Pool: Hypergeometric Inference and a Result That Runs Backwards
The unseen tiles are one pool
From one player’s point of view, tiles divide into two classes: seen (their own hand, every discard, every exposed meld) and unseen. The unseen part contains both the wall and the other three hands, and the player cannot distinguish them. So “how many of this type remain” has an exact answer (4 minus the number seen), while “will I draw one” is a hypergeometric question (Feller 1968).
Calculation
# Chapter 2. The tile pool as a hypergeometric inference problem. A player
# sees their own hand, every discard, and every exposed meld. Everything else
# -- the wall and the three concealed hands -- is one undifferentiated pool
# from that player's point of view, and the question "how many of tile t are
# left" has an exact answer, while "will I draw one" is hypergeometric. The
# program computes the probability of drawing at least one of a set of useful
# tiles in the remaining draws, and shows how much the answer moves when a
# single copy becomes visible. Exact arithmetic; standard library only.
import math
TYPES, COPIES = 34, 4
TOTAL = TYPES * COPIES # 136
DEAD_WALL = 14 # set aside, never drawn in the standard rule
def own_draws_left(turn, players=4):
"""Draws this player still takes, if the live wall is exhausted at turn
18."""
return max(0, 18 - turn)
def p_at_least_one(useful_left, pool, draws):
"""Hypergeometric: P(at least one useful tile among `draws` from
`pool`)."""
if draws <= 0 or useful_left <= 0:
return 0.0
if useful_left >= pool:
return 1.0
# P(none) = C(pool - useful, draws) / C(pool, draws)
return 1.0 - math.comb(pool - useful_left, draws) / math.comb(pool, draws)
if __name__ == "__main__":
print(
"Set of {} tiles; {} set aside in the dead wall.".format(
TOTAL, DEAD_WALL
)
)
print(
"A player's own draws remaining are counted from the turn number.\n"
)
# a typical mid-game position: own 13 tiles, 36 tiles visible as
# discards/melds
own, visible = 13, 36
pool = TOTAL - DEAD_WALL - own - visible
print(
"Mid-game: own hand {}, visible tiles {}, so the unseen pool this"
" player".format(own, visible)
)
print(
"draws from (wall plus three concealed hands) is {} tiles.\n".format(
pool
)
)
print(
"A. Probability of drawing at least one acceptance tile, by how many"
" copies"
)
print("remain and how many draws are left:")
print(" copies left 4 draws 8 draws 12 draws 16 draws")
for left in (1, 2, 3, 4, 6, 8):
print(
" {:11d}".format(left)
+ "".join(
"{:10.3f}".format(p_at_least_one(left, pool, d))
for d in (4, 8, 12, 16)
)
)
print(
"\nB. What one visible copy is worth. A wait on a tile type with 4"
" copies"
)
print("live, as copies appear in discards, with 10 draws remaining:")
base = None
for seen in (0, 1, 2, 3):
left = 4 - seen
p = p_at_least_one(left, pool, 10)
if base is None:
base = p
print(
" {} copies visible -> {} live: P = {:.3f} ({:+.1%} relative"
" to none visible)".format(seen, left, p, p / base - 1)
)
print(
"\n The first visible copy costs about a sixth of the chance; the"
" third"
)
print(
" costs more than half. This is the formal content of the ordinary"
" advice"
)
print(
" to abandon a wait whose tiles are mostly gone, and the size"
" of the"
)
print(" effect is set by the pool, not by intuition.")
print(
"\nC. A two-sided wait against a one-sided wait, same number of draws"
" (10):"
)
for label, left in (("two-sided (8 live)", 8), ("one-sided (4 live)", 4),
("pair wait (2 live)", 2)):
print(
" {:22s} P = {:.3f}".format(
label, p_at_least_one(left, pool, 10)
)
)
ratio = p_at_least_one(8, pool, 10) / p_at_least_one(4, pool, 10)
print(
" The two-sided wait is {:.2f} times the one-sided wait in"
" probability of".format(ratio)
)
print(
" acceptance -- NOT twice the number of live tiles, because with"
" ten draws"
)
print(" left both probabilities are already saturating.")
print("\nD. How that ratio depends on how many draws remain:")
print(" draws left two-sided / one-sided ratio stage of the hand")
for d, stage in ((2, "late"), (4, "late"), (8, "middle"), (12, "early"),
(16, "very early")):
a = p_at_least_one(8, pool, d)
b = p_at_least_one(4, pool, d)
print(
" {:10d} {:28.3f} {}".format(
d, a / b if b > 0 else float("nan"), stage
)
)
print(
"\n Note the direction, which is easy to get backwards. FEW draws"
" left"
)
print(
" means LATE in the hand, and there the ratio is {:.2f}, close to"
" the 2.0".format(
p_at_least_one(8, pool, 2) / p_at_least_one(4, pool, 2)
)
)
print(
" that counting live tiles would predict. With many draws left --"
" EARLY in"
)
print(
" the hand -- the ratio falls to {:.2f}, because both waits have"
" time to be".format(
p_at_least_one(8, pool, 16) / p_at_least_one(4, pool, 16)
)
)
print(" hit and the probabilities saturate toward 1.")
print(
" So counting acceptance tiles as proportional to the chance of"
" completion"
)
print(
" is accurate LATE and overstates wide waits EARLY. The practical"
" reading"
)
print(
" is the reverse of the usual emphasis: early in the hand the width"
" of a"
)
print(
" wait matters less than it looks, and what matters more is the"
" value of"
)
print(" the hand and the shape's flexibility (Chapter 4).")
print(
"\nE. The inference the pool does NOT support. The {} unseen tiles"
" include".format(pool)
)
print(
" 39 tiles in opponents' hands, and the hypergeometric calculation"
" above"
)
print(
" treats them as if they were in the wall. That is wrong"
" whenever an"
)
print(
" opponent is holding the tile BECAUSE it is useful to them,"
" which is"
)
print(
" precisely the case for the tiles a player most wants. Chapter 3"
" models"
)
print(
" that dependence; the numbers above are the no-dependence"
" baseline and"
)
print(" are therefore optimistic for contested tiles.")
# Set of 136 tiles; 14 set aside in the dead wall.
# A player's own draws remaining are counted from the turn number.
#
# Mid-game: own hand 13, visible tiles 36, so the unseen pool this player
# draws from (wall plus three concealed hands) is 73 tiles.
#
# A. Probability of drawing at least one acceptance tile, by how many copies
# remain and how many draws are left:
# copies left 4 draws 8 draws 12 draws 16 draws
# 1 0.055 0.110 0.164 0.219
# 2 0.107 0.209 0.304 0.393
# 3 0.158 0.298 0.421 0.530
# 4 0.206 0.378 0.521 0.637
# 6 0.296 0.515 0.674 0.787
# 8 0.378 0.625 0.781 0.877
#
# B. What one visible copy is worth. A wait on a tile type with 4 copies
# live, as copies appear in discards, with 10 draws remaining:
# 0 copies visible -> 4 live: P = 0.453 (+0.0% relative to none visible)
# 1 copies visible -> 3 live: P = 0.362 (-20.1% relative to none visible)
# 2 copies visible -> 2 live: P = 0.257 (-43.3% relative to none visible)
# 3 copies visible -> 1 live: P = 0.137 (-69.7% relative to none visible)
#
# The first visible copy costs about a sixth of the chance; the third
# costs more than half. This is the formal content of the ordinary advice
# to abandon a wait whose tiles are mostly gone, and the size of the
# effect is set by the pool, not by intuition.
#
# C. A two-sided wait against a one-sided wait, same number of draws (10):
# two-sided (8 live) P = 0.712
# one-sided (4 live) P = 0.453
# pair wait (2 live) P = 0.257
# The two-sided wait is 1.57 times the one-sided wait in probability of
# acceptance -- NOT twice the number of live tiles, because with ten draws
# left both probabilities are already saturating.
#
# D. How that ratio depends on how many draws remain:
# draws left two-sided / one-sided ratio stage of the hand
# 2 1.943 late
# 4 1.837 late
# 8 1.652 middle
# 12 1.500 early
# 16 1.377 very early
#
# Note the direction, which is easy to get backwards. FEW draws left
# means LATE in the hand, and there the ratio is 1.94, close to the 2.0
# that counting live tiles would predict. With many draws left -- EARLY in
# the hand -- the ratio falls to 1.38, because both waits have time to be
# hit and the probabilities saturate toward 1.
# So counting acceptance tiles as proportional to the chance of completion
# is accurate LATE and overstates wide waits EARLY. The practical reading
# is the reverse of the usual emphasis: early in the hand the width of a
# wait matters less than it looks, and what matters more is the value of
# the hand and the shape's flexibility (Chapter 4).
#
# E. The inference the pool does NOT support. The 73 unseen tiles include
# 39 tiles in opponents' hands, and the hypergeometric calculation above
# treats them as if they were in the wall. That is wrong whenever an
# opponent is holding the tile BECAUSE it is useful to them, which is
# precisely the case for the tiles a player most wants. Chapter 3 models
# that dependence; the numbers above are the no-dependence baseline and
# are therefore optimistic for contested tiles.What one visible copy is worth
Section B gives a useful magnitude: taking four copies live and ten draws remaining as the baseline, the first visible copy lowers the completion probability by about a sixth, and the third lowers it by more than half. That is the formal content of the ordinary advice to abandon a wait whose tiles have mostly appeared, and its size is set by the pool rather than by intuition.
The result whose direction is easy to invert
Sections C and D are the point of the chapter, and the direction runs opposite to the common account.
The ratio of completion probability for a two-sided wait (8 live) against a one-sided wait (4 live) is 1.57 with ten draws remaining — not 2, because both probabilities are already saturating. Section D lists that ratio against the number of draws remaining:
- two draws remaining (late in the hand): 1.943, close to the 2.0 that counting live tiles predicts;
- sixteen draws remaining (early in the hand): 1.377.
The direction is easy to invert: few draws remaining means late in the hand. So
estimating completion in proportion to acceptance count is accurate late in the hand and overstates wide waits early.
The practical reading is the reverse of the usual emphasis: early in the hand, the width of a wait matters less than it looks, and what matters more is the value of the hand and the flexibility of the shape (Chapter 4). By the late turns, counting live tiles is the right thing to do.
Hypothesis · not established
The author’s hypothesis (not established): in the duplicate design of Chapter 8, a policy that chooses by hand value rather than acceptance count for the first six turns and by live-tile count for the last six beats a policy that chooses by acceptance count throughout. What would show it to be wrong: a 95 % confidence interval for that comparison that includes zero, or runs in the opposite direction.
The inference this calculation does not support
Section E states a limit that matters later. The hypergeometric calculation treats the 73 unseen tiles as one uniform pool, when 39 of them are in opponents’ hands. The assumption fails whenever an opponent holds a tile precisely because it is useful to them — which is exactly what happens with the tiles a player most wants.
So this chapter’s figures are the no-dependence baseline and are optimistic for contested tiles. Chapter 3 handles that dependence, and it does so by modelling the distribution of opponents’ hands, which is far less reliable than this chapter’s hypergeometric calculation. The methodological principle of Chapter 1 bites for the first time here: this chapter deals in quantities of the first kind, depending only on one’s own tiles and the seen tiles, and Chapter 3 deals in the second kind.
Note
Relation to Volume 37. Volume 37 covered discrete cyclical networks and occupancy entropy, where the object is a distribution of occupancy; this chapter’s object is sampling rather than occupancy. The two are mathematically different and should not be applied to each other.
Summary
From one player’s point of view the unseen tiles form a uniform pool, and “will I draw one” is hypergeometric. A visible copy has a computable cost: with four copies live and ten draws remaining, the first visible copy lowers the completion probability by about a sixth and the third by more than half. The chapter’s main result has a direction that is easy to invert: the ratio of completion probability for a two-sided to a one-sided wait is 1.94 with two draws left (late in the hand), close to the 2.0 that counting live tiles predicts, and falls to 1.38 with sixteen draws left (early), because both waits have time to be hit. So counting acceptance tiles is accurate late and overstates wide waits early, and the practical reading is that hand value and shape flexibility matter more early on. Finally, the hypergeometric calculation treats the 39 tiles in opponents’ hands as wall, so it is optimistic for contested tiles — which are exactly the tiles a player most wants.
References
Fan, Y. (2026). Imperfect-Information Stochastic Games, Bayesian Hand-Reading and Counterfactual Regret Minimisation in Four-Player Tile Dynamics: From Markov Transitions of the Tile Pool and the Optimal Stopping of Defensive Folding to Kelly Allocation in a Multiplayer Game, with a Textual Examination of the Orthodox and the Unorthodox in the Classical Military Writers [四人不完全信息随机博弈、贝叶斯读牌与反事实遗憾最小化] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24020464 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).