An interactive Python GUI application to simulate dice rolls and visualize probability distributions, comparing empirical results with the exact theoretical distribution.
The project is designed to be:
- simple
- modular
- extensible (2D now, 3D later)
- π² Define arbitrary dice sets (e.g. 2D6, 3D4 1D20)
- π Roll dice interactively or run large Monte Carlo simulations
- π Live histogram of simulated sums
- π Exact theoretical distribution overlay (via convolution)
- Bars: empirical distribution from simulations
- Line: exact probability distribution
- As simulations increase, the bars converge to the line (law of large numbers)
DICE PROBABILITY VISUALIZER/
β
βββ source/
βββ dice_set.py # Dice and DiceSet logic
βββ viz.py # PyQt6 GUI
βββ main.py # Main file to run the application
βββ README.md-
Dice: single die (e.g. D6, D20)
-
DiceSet: collection of dice with:
- rolling
- simulation
- exact distribution computation
Requirements:
- Python β₯ 3.9
pip install numpy pyqt6 pyqtgraph py main.py