About RollQuest

A Stochastic Dice Game Simulation for Academic Study

Project Overview

RollQuest is an interactive web-based simulation designed to demonstrate fundamental concepts in Modeling and Simulation. The project uses a simple dice betting game as a vehicle to explore probability theory, stochastic processes, and statistical analysis.

The simulation allows users to experience the difference between a fair game (where each dice face has equal probability) and a tweaked game (where probabilities can be customized), providing hands-on understanding of how probability distributions affect outcomes over time.

Key Features
  • Interactive Dice Game - Real-time betting with animated dice rolls
  • Fair & Tweaked Modes - Compare uniform vs. custom probability distributions
  • Monte Carlo Simulation - Run thousands of trials to analyze outcomes
  • Statistical Analysis - Chi-square tests, convergence analysis, and more
  • Multiple Betting Strategies - Fixed, Martingale, Anti-Martingale, Kelly Criterion
  • Data Export - Export results for further analysis
Technologies Used
  • Python Flask
  • NumPy & SciPy
  • Plotly.js
  • Bootstrap 5
  • HTML5 / CSS3 / JS

Theoretical Comparison: Fair vs. Tweaked

Fair Game

In a fair dice game, each face has an equal probability of appearing:

P(Face = i) = 1/6 ≈ 16.67% for i ∈ {1, 2, 3, 4, 5, 6}
Expected Value of Dice Roll
E[X] = Σ(i × P(i)) = (1+2+3+4+5+6)/6 = 3.5
Variance
Var(X) = E[X²] - (E[X])² = 35/12 ≈ 2.917
Expected Value per Bet (6x payout)
E[Profit] = (1/6 × 6 - 1) × Bet = 0

A fair game with 6x payout is mathematically break-even in the long run.

Tweaked Game

In a tweaked game, probabilities are customized:

P = [p₁, p₂, p₃, p₄, p₅, p₆] where Σpᵢ = 1
Example: Biased Against Face 1
P(1) = 10%, P(2-6) = 18% each
House Edge Calculation
House Edge = (1 - P(win) × Payout) × 100%

If player always bets on Face 1:

House Edge = (1 - 0.10 × 6) × 100% = 40%
Expected Loss per $10 Bet
E[Loss] = (0.10 × 60 - 10) = -$4.00

A seemingly small probability change creates massive player disadvantage!

Side-by-Side Comparison
Metric Fair Game Tweaked (10% on target) Impact
Win Probability 16.67% 10.00% -40% relative
Expected Value/Bet ($10) $0.00 -$4.00 Player loses $4/bet
House Edge 0% 40% Massive disadvantage
100 Bets Expected Loss $0 -$400 Bankruptcy likely
Long-term Outcome Break-even Certain loss -

Academic Concepts Demonstrated

Stochastic Processes

Each dice roll is an independent random variable. The sequence of rolls forms a stochastic process, demonstrating how randomness behaves over time.

Law of Large Numbers

As the number of trials increases, the empirical probability converges to the theoretical probability. Our convergence analysis visualizes this principle.

Central Limit Theorem

The distribution of sample means approaches a normal distribution as sample size increases, regardless of the underlying distribution.

Monte Carlo Methods

Using random sampling to obtain numerical results. Our simulation runs thousands of trials to estimate probabilities and expected values.

Gambler's Ruin Problem

The probability of going bankrupt when playing repeatedly. Our batch simulations calculate ruin probability under different conditions.

Statistical Testing

Chi-square goodness-of-fit tests verify if observed outcomes match expected distributions, detecting potential biases.

Development Team

ASIADO

Developer

VALLE

Developer

MEDIADO

Developer

CSEC 413 - Modeling and Simulation

Bachelor of Science in Computer Science 4A

References & Further Reading

Probability & Statistics
  • Ross, S. M. (2014). Introduction to Probability Models
  • DeGroot, M. H. (2012). Probability and Statistics
  • Casella, G. & Berger, R. (2002). Statistical Inference
Simulation & Monte Carlo
  • Law, A. M. (2015). Simulation Modeling and Analysis
  • Rubinstein, R. Y. (2016). Simulation and the Monte Carlo Method
  • Banks, J. (2010). Discrete-Event System Simulation