Home▸Game Development▸Casino House Edge & Bankroll Simulator (2D)

🎰 Casino House Edge & Bankroll Simulator (2D)

A real probability lab, not a decoration: pick an actual casino game with its real house edge, place bets at whatever speed you like, and watch your bankroll trace out against the theoretical expected-value line and a ±2σ variance band computed from the binomial statistics of the bets you've placed.

Game Development2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-casino-model ↗ Open standalone

Every bet in this lab is modeled as an even-money wager: win and you gain one bet, lose and you give up one bet, with the win probability p set so that p·(+1) + (1−p)·(−1) exactly equals the negative of the stated house edge. That single number is what casinos actually sell — European roulette's 2.70% comes from the extra green zero pocket, American roulette's 5.26% from two of them, and basic-strategy blackjack's 0.50% from how close correct play gets you to a fair coin flip. Run enough rounds and the solid bankroll line converges on the dashed expected-value line no matter how it wandered early on; that convergence, and how wide the ±2σ band around it still is even after thousands of rounds, is the whole story of why the house always wins on average while any single player can still walk away up.

❓ FAQ

Why model every game as an even-money bet?

It isolates the one variable that matters for this lab — the house edge — from the payout structure of each specific game. A real slot machine pays wildly uneven amounts with different probabilities, but its expected return to player is still a single number, and an even-money bet with the same edge produces the same long-run bankroll trajectory and (for a first-order comparison) similar variance per unit wagered.

What does the ±2σ band actually mean?

For an even-money bet with win probability p, the variance of your net result after n rounds is n·bet²·4p(1−p). The shaded band is two standard deviations above and below the expected-value line — under a normal approximation, about 95% of simulated sessions should stay inside it. Watch it widen as √n even as the gap between the EV line and zero grows linearly — that's why short sessions feel unpredictable and long ones feel inevitable.

Can the bankroll ever beat the house edge?

Any individual run can, since the underlying process is still random — that's the point of the variance band. What can't change is the mean: over enough rounds at a fixed bet size, the expected loss is exactly edge × total wagered, which is also exactly how casinos budget their revenue per table per year.

⚙ Under the hood

Canvas2D bankroll simulator: each round draws a Bernoulli outcome with win probability derived from the selected game's real house edge, plots the running bankroll against a closed-form expected-value line, and shades a ±2σ band from the binomial variance of the bets placed so far.

house edgeexpected valuevarianceprobabilitybankroll simulationgambler's ruin

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)