"""Mines 'predictor' chance baseline (exact arithmetic + Monte Carlo cross-check), 21 Nov 2026. Question: how often does a predictor that only GUESSES look right, and how much evidence would a real predictor need to show? Game-agnostic: any 5x5 Mines where m mines are placed uniformly at random among 25 tiles each round (independent rounds). No paytable is used, so this holds for Spribe Mines, Stake Mines and clones alike. 18+, educational; nothing here helps anyone win. Outputs: predictor-baseline-2026-11-21.csv and predictor-baseline-mc-2026-11-21.csv.""" import csv, math from fractions import Fraction as F from math import comb import numpy as np def p_safe(m, k): # P(k chosen tiles are all safe) = C(25-m,k)/C(25,k) return F(comb(25 - m, k), comb(25, k)) def upper_tail(N, x, p): # exact P(X >= x), X ~ Bin(N, p), p a Fraction a, b = p.numerator, p.denominator num = sum(comb(N, i) * a**i * (b - a)**(N - i) for i in range(x, N + 1)) return F(num, b**N) def crit(N, p0, alpha): # smallest x with P(X>=x | p0) <= alpha lo, hi = 0, N + 1 # tail is decreasing in x; binary search while lo < hi: mid = (lo + hi) // 2 if upper_tail(N, mid, p0) <= alpha: hi = mid else: lo = mid + 1 return lo def n_required(p0, p1, alpha=F(1, 100), power=F(8, 10), nmax=3000): for N in range(1, nmax + 1): x = crit(N, p0, alpha) if x <= N and upper_tail(N, x, p1) >= power: return N, x return None, None CELLS = [(1, 1), (1, 5), (3, 1), (3, 3), (3, 5), (5, 1), (5, 3), (10, 1), (10, 2), (20, 1), (24, 1)] rows = [] for m, k in CELLS: p0 = p_safe(m, k) streak = math.ceil(math.log(1e-3) / math.log(float(p0))) # P(all n correct by luck) < 1/1000 p_half = 1 - (1 - p0) / 2 # a predictor that halves the error rate n_half, x_half = n_required(p0, p_half) p99 = F(99, 100) n99, x99 = (n_required(p0, p99) if p0 < p99 else (None, None)) rows.append({ "mines": m, "picks": k, "p_guess_correct_exact": f"{p0.numerator}/{p0.denominator}", "p_guess_correct": f"{float(p0):.6f}", "winning_screenshots_per_1000_guessing_followers": f"{1000*float(p0):.1f}", "p_10_straight_correct_by_luck": f"{float(p0**10):.6f}", "streak_needed_for_luck_below_1_in_1000": streak, "halved_error_rate_p1": f"{float(p_half):.6f}", "preregistered_predictions_needed_halved_error (alpha=0.01, power=0.80)": n_half, "correct_needed_of_those": x_half, "preregistered_predictions_needed_if_claim_99pct": n99 if n99 else "n/a (chance >= 99%)", "correct_needed_of_those_99": x99 if x99 else "n/a", }) print(rows[-1]) with open("predictor-baseline-2026-11-21.csv", "w", newline="") as f: w = csv.DictWriter(f, fieldnames=list(rows[0])); w.writeheader(); w.writerows(rows) # Monte Carlo: three tile-picking 'systems' vs random boards. Seed fixed for reproducibility. rng = np.random.default_rng([20261121, 7]) N, CH = 1_000_000, 200_000 mc = [] for m, k in [(3, 1), (3, 5), (5, 3), (10, 2)]: hits = {"fixed_corner_tiles": 0, "random_tiles": 0, "avoid_last_rounds_mines": 0} prev_mines = None for _ in range(N // CH): boards = np.argsort(rng.random((CH, 25)), axis=1)[:, :m] # mine positions mine = np.zeros((CH, 25), bool); np.put_along_axis(mine, boards, True, axis=1) # system 1: always the same k tiles (0..k-1) hits["fixed_corner_tiles"] += int((~mine[:, :k].any(axis=1)).sum()) # system 2: k random tiles picks = np.argsort(rng.random((CH, 25)), axis=1)[:, :k] hits["random_tiles"] += int((~np.take_along_axis(mine, picks, axis=1).any(axis=1)).sum()) # system 3: pick tiles that were NOT mines in the previous round (pattern-chasing) prev = np.vstack([prev_mines[None, :] if prev_mines is not None else np.zeros((1, 25), bool), mine[:-1]]) score = rng.random((CH, 25)) + prev * 2.0 # previous-round mine tiles sorted last picks3 = np.argsort(score, axis=1)[:, :k] hits["avoid_last_rounds_mines"] += int((~np.take_along_axis(mine, picks3, axis=1).any(axis=1)).sum()) prev_mines = mine[-1] p0 = float(p_safe(m, k)) for s, h in hits.items(): ph = h / N; z = 1.959964; d = 1 + z*z/N c = (ph + z*z/(2*N)) / d; hw = z*math.sqrt(ph*(1-ph)/N + z*z/(4*N*N)) / d mc.append({"mines": m, "picks": k, "system": s, "rounds": N, "survived": h, "sim_rate": f"{ph:.6f}", "wilson95_lo": f"{c-hw:.6f}", "wilson95_hi": f"{c+hw:.6f}", "exact": f"{p0:.6f}", "exact_inside_ci": "yes" if c-hw <= p0 <= c+hw else "NO"}) print(mc[-1]) with open("predictor-baseline-mc-2026-11-21.csv", "w", newline="") as f: w = csv.DictWriter(f, fieldnames=list(mc[0])); w.writeheader(); w.writerows(mc)