Exercises: Game Simulation
Exercise 1: Basic Monte Carlo
Implement a basic game simulation where: - Home team expected score: 24 points - Away team expected score: 21 points - Score standard deviation: 10 points
Tasks: a) Run 10,000 simulations and calculate home win probability b) Calculate the probability the home team wins by 7+ c) Calculate the probability of a one-score game (margin ≤ 8) d) What is the 90% confidence interval for the margin?
Exercise 2: Simulation Precision
You run simulations with different sample sizes: - 100 simulations: 58% home win - 1,000 simulations: 54% home win - 10,000 simulations: 55.2% home win - 100,000 simulations: 55.4% home win
Tasks: a) Calculate the standard error for each sample size b) At what sample size does precision become "sufficient"? c) Why did 100 simulations give such a different result? d) How many simulations would you need for ±0.1% precision?
Exercise 3: Score Correlation
Two scenarios for simulating correlated scores: - Scenario A: Independent scores (correlation = 0) - Scenario B: Correlated scores (correlation = 0.15)
Tasks: a) Explain why NFL scores might be correlated b) Implement both scenarios and compare total points distributions c) How does correlation affect the probability of high-scoring games? d) Does correlation significantly affect win probability?
Exercise 4: Realistic Score Distribution
NFL scores tend to cluster around certain values (7, 10, 14, 17, 20, 21, 24, 27, etc.)
Tasks: a) Explain why certain scores are more common than others b) Modify your simulator to produce more realistic score distributions c) Compare the distribution of simulated scores to historical NFL data d) Does this adjustment significantly change win probabilities?
Exercise 5: Drive Outcome Probabilities
Given these drive outcome probabilities: - Touchdown: 22% - Field Goal: 15% - Punt: 38% - Turnover: 12% - Other: 13%
Tasks: a) Calculate expected points per drive b) If a team has 12 drives per game, what's their expected score? c) Simulate 100 drives and compare to expected d) How does drive-based expected score compare to historical averages?
Exercise 6: Team Rating Adjustment
Modify drive probabilities based on team ratings: - Elite offense: +5% TD rate, +3% FG rate - Poor defense: +3% TD rate against - Combined effect should stack appropriately
Tasks: a) Design a formula for adjusting drive probabilities b) Ensure probabilities still sum to 1.0 after adjustment c) Simulate games between elite offense vs elite defense d) How much does team quality affect expected points per drive?
Exercise 7: Full Game Simulation
Build a complete game simulator with: - 4 quarters of 15 minutes each - Drive time varying by outcome (2-4 minutes typical) - Possession changes after scores and turnovers
Tasks: a) Implement the basic game loop b) Track score by quarter c) Count total drives per game (compare to real ~12 per team) d) Simulate 1,000 games and analyze score distributions
Exercise 8: Overtime Simulation
Implement NFL overtime rules (simplified): - Each team gets at least one possession - Game ends if first team scores TD - After initial possessions, next score wins
Tasks: a) Implement overtime logic b) What percentage of games go to overtime? c) Of overtime games, what percentage does the coin-toss winner win? d) Compare your overtime stats to actual NFL overtime data
Exercise 9: Season Simulation
Given 17-game schedules for 32 teams:
Tasks: a) Simulate one complete season and record all standings b) Simulate 10,000 seasons and calculate playoff probabilities c) For a 3-3 team after 6 games, what's their playoff probability range? d) How much does one win change playoff probability mid-season?
Exercise 10: Live Win Probability
Simulate live win probability for these scenarios: - Home leads 14-7, start of 3rd quarter - Home trails 21-24, 2 minutes left in 4th - Tied 17-17, 5 minutes left in 4th
Tasks: a) Calculate win probability for each scenario b) How does possession affect these probabilities? c) Create a win probability graph for an example game d) Compare to NFL's actual win probability model
Exercise 11: Spread Probability
The spread is -7 (home favored). Simulate to find:
Tasks: a) Probability home team covers -7 b) Probability of push (exactly 7-point margin) c) Distribution of "cover/no cover" across 1,000 simulations d) Why is push probability relatively low?
Exercise 12: Total Points Simulation
For an over/under of 47.5:
Tasks: a) Simulate to find P(total > 47.5) b) Simulate to find expected total c) How does score correlation affect over/under probability? d) What game parameters most affect total points variance?
Exercise 13: Fantasy Projection Ranges
A QB has an expected 20 fantasy points with std of 7:
Tasks: a) Simulate 10,000 games to get projection range b) Calculate floor (10th percentile) and ceiling (90th percentile) c) What's the probability of a "bust" game (<10 points)? d) What's the probability of a "boom" game (>30 points)?
Exercise 14: Playoff Scenario Analysis
Your team is 7-5 with 5 games remaining. They need 10+ wins for playoffs.
Tasks: a) Simulate remaining schedule to find playoff probability b) How does this change if they win next week? c) What record guarantees playoffs? d) Create a scenario tree showing paths to playoffs
Exercise 15: Model Validation
Compare your simulation outputs to historical NFL data:
Tasks: a) Compare score distributions (use KS test) b) Compare margin distributions c) Check close game frequency (margin ≤ 7) d) Identify any systematic biases in your simulator
Exercise 16: Sensitivity Analysis
Test how simulation results change with different inputs:
Tasks: a) Vary score standard deviation from 8 to 12 b) Vary home advantage from 1.5 to 3.5 c) Vary score correlation from 0 to 0.25 d) Which parameter has the largest effect on win probability?
Exercise 17: Conditional Probabilities
Given that home team is leading by 7 at halftime:
Tasks: a) What's the conditional probability they win? b) What's the conditional probability they win by 14+? c) How does this compare to unconditional win probability? d) At what halftime lead is win probability >90%?
Exercise 18: Game Script Analysis
Simulate games with different "scripts": - Home team builds early lead - Away team comes from behind - Back-and-forth game
Tasks: a) Define what makes each script likely b) Simulate and categorize games by script c) What percentage of games follow each pattern? d) Does script correlate with final margin?
Exercise 19: Blowout Probability
Define a blowout as margin ≥ 21 points.
Tasks: a) Simulate to find overall blowout probability b) How does this vary with team quality mismatch? c) What rating difference leads to 25% blowout probability? d) Compare to actual NFL blowout frequency
Exercise 20: Complete Simulation System
Build a complete NFL simulation system with: - Game simulation (score-based) - Season simulation - Playoff simulation - Win probability calculator
Deliverables: a) Modular code with clear interfaces b) Validation results against historical data c) Documentation of assumptions d) Example outputs for a sample week/season
Programming Challenges
Challenge A: Real-Time Dashboard
Build a dashboard that: - Shows live win probability for a game - Updates as you input current score/time - Displays probability distributions - Shows key scenarios
Challenge B: EPA-Based Simulation
Replace simple drive probabilities with: - Expected Points Added (EPA) per play - Play-by-play simulation - Situation-dependent outcomes
Compare accuracy to simpler models.
Challenge C: Tournament Simulator
Build a playoff/tournament simulator: - Bracket-based competition - Reseeding options - Multiple tournament formats - Upset probability tracking
Challenge D: Historical Validation Framework
Create a comprehensive validation system: - Automated comparison to historical data - Multiple metrics (scores, margins, totals, overtime) - Statistical tests for distribution similarity - Visualization of calibration