Inspiration

House Edge hands you gameplay logs from simulated slot machines and asks for the odds of the next spin: 0×, 1×, 2×, 5× or 20×. The answers are scored against the simulator's true probabilities, not lucky outcomes. That makes it a pure "how well do you understand the machine" problem, so we treated it like reverse-engineering a system rather than throwing a generic model at it.

What it does

For every machine and cutoff tick, our forecaster outputs five calibrated payout probabilities using only spins before that tick. It handles three machine types (steady, balanced, jackpot) and four kinds of episodes: stable, short history, gradual drift, and sudden shared change. Everything runs in plain Python with no dependencies, in about five minutes.

How we built it

We started by banking the organizers' baseline (30/60), then dug into the data before modeling:

  • Wins follow an XOR of two earlier spins. Each machine's win chance depends on whether two specific earlier spins matched or differed. In the main round only three lag pairs recur: (1,3), (2,5) and (4,7).
  • Patterns reverse. In drift episodes the XOR direction flips gradually; in shared-change episodes it flips suddenly for every machine at once.
  • Payout sizes come from two fixed profiles per machine type, switched by whether recent payouts were big (2× or more).

The model is Bayesian model averaging over hundreds of small per-machine context models: single lags, lag pairs, XOR pairs, and XOR models that can reverse direction through a two-state hidden Markov chain. Each candidate is weighted by how well it predicted that machine's own past, one step at a time. A prior over which patterns are common is learned from the training data, so nothing about the specific lag pairs is hard-coded. A second model average predicts payout size given a win.

Each version was a measurable step:

Version Main-round validation (/60) What changed
Baseline 30.0 Organizers' pooled starter
v1 51.4 Model averaging over lag contexts
v2 54.1 XOR contexts + learned pattern prior
v3 54.6 Two payout-size profiles per type
v4 55.3 Reversible (flip) XOR models
v5 55.9 Win rates tied to per-type values
v6 56.6 Size contexts on big-payout lags

Round two: adapting to changed patterns

Round two released fresh data where "some patterns have changed." Because our model learns which patterns recur from whatever training data it's given, we ran the exact same code, unchanged, on the new kit. It scored about 18.8 / 20 on round-two validation: its error was about 6.5% of the baseline's, essentially the same as in the main round. No retuning was needed; the design choice to learn structure instead of hard-coding it paid off.

We also built a diagnostic script that reports, in seconds, which spin patterns drive wins, how extreme the win rates are, whether patterns reverse, and what drives payout size, so a new dataset can be understood immediately.

Challenges we ran into

  • Short histories: some machines only show about 64 spins, which is barely enough to learn a pattern. Tying win rates to typical per-type values cut that error by about 25%.
  • Changing patterns: a model that trusts long history fails when the pattern flips. Explicitly modeling the flip beat simply forgetting faster.
  • Not fooling ourselves: with validation answers public, overfitting was a real risk. We re-ran model selection on random halves of the validation episodes. It picked the same model on every split, and held-out halves scored 56.2–56.8. Round two, on fresh data, confirmed it.
  • Reproducibility: organizers rerun your code offline, so we kept it standard-library only and verified it recreates the CSV byte for byte from a fresh unzip.
  • Logistics: round two landed during Sunday church. We submitted it from a phone, sending the data files through chat and getting the finished entry back within minutes.

Accomplishments that we're proud of

  • 56.6/60 on main-round validation (baseline 30, theoretical max 60) and about 18.8/20 on round two with zero code changes.
  • Rules found in the data, not hand-tuned guesses.
  • A deterministic, dependency-free submission that reproduces exactly.

What we learned

Looking at the data beats reaching for a bigger model. The biggest jumps came from discovering structure (XOR pairs, reversals, payout profiles), not from tuning. Designing the model to learn that structure, instead of hard-coding what we found, is what made it survive round two's changes. We also learned to test validation gains on held-out splits before trusting them.

What's next

  • Pool evidence across machines to detect episode-wide flips faster.
  • Close the remaining gap on short-history machines.
  • Use main-round data as an extra prior when a new round has little training data.

Built with: Python, plus Claude (Anthropic) as a coding assistant.

Built With

Share this project:

Updates

Submission history