How it works

What happens when you swap a player into a moment: how we set the scene, how we turn a player-season into a playoff version of him, how each possession plays out, and every number the simulation uses. No code, just the basketball and the arithmetic.

Where a moment startsThe last dead ball before the famous play, rebuilt from the real play-by-play.

Every moment starts at the last dead ball before the famous play: after the free throws, the timeout, or the substitutions, not at the instant of the shot. That way the whole sequence plays out, so your swap can change who shoots, who rebounds, and who's open.

Ray Allen's corner three went in with 5.2 seconds left, but the moment starts at 19.4 seconds: Heat down 3, Heat ball, right after Kawhi Leonard's free throws. LeBron's miss and Chris Bosh's offensive rebound are part of the moment.

The score, clock, who has the ball, and the ten players on the floor all come from the real play-by-play. The play-by-play never says who was on the floor, only who checked in and out, so we work it out: a player started a quarter if he shows up in it before he ever checks in. If it's ever ambiguous, we stop and check instead of guessing.

No swap: what really happenedNo swap means you watch the real ending, play by play.

History can only change if you change something. With no swap, you watch the real ending, play by play from the real play-by-play: every shot, rebound, foul, substitution, and overtime, ending on the real final score.

Your player's playoff versionHis real playoff stats, blended with a projection from his regular season.

You pick a player and a season. Every moment is a playoff moment, so the sim needs his playoff version of that season. Some seasons have a full playoff run behind them, some have one game, some have none (his team missed, or he was hurt). We blend what he actually did in the playoffs with a projection from his regular season, trusting each by how much data backs it.

playoff version = trust × his real playoff stats  +  (1 − trust) × his projection

trust = his playoff minutes ÷ (his playoff minutes + 300)
A full playoff run of 700 minutes: trust = 70%, so it's mostly what he really did. One game of 40 minutes: trust = 12%, so mostly his regular season. No playoff games: trust = 0%, a pure projection. What if Jordan's Bulls had beaten the Pistons?

The projection from his regular season

projection = his regular season
           × how the league changed in that season's playoffs
           × his personal step-up from his other playoff runs

How the league changes: we compare the same playoff teams in their own regular season against their playoffs. Over 30 seasons, they scored fewer points per game in the playoffs every single season, about 4.3% fewer: roughly 2.4% from a slower pace and 1.7% from tighter defense.

His personal step-up: some players rise in the playoffs and some fade. We measure how much more (or less) than the league each player changed in his other playoff runs, with seasons closer to the one you picked counting more. It's trusted by how many playoff minutes back it up (half-trusted at 600 minutes), and anything beyond 0.6× to 1.6× is treated as noise.

his step-up = (his playoff number ÷ his regular-season number) ÷ (the league's same change)

1.00 = he changed exactly as much as everyone else
1.10 = he stepped up 10% beyond the league
Jalen Brunson in 2023–24 took 35.2% of the Knicks' plays in the playoffs vs. 31.1% in the regular season: a 1.13 step-up in usage. Ray Allen in 2012–13 shot about the same in the playoffs while the league got 3% worse: a 1.03 step-up in shooting.

Shooting by zone

Every shot comes from one of seven zones (at the rim, in the paint, mid-range, left corner three, right corner three, above-the-break three, backcourt heave). A player's make rate in each zone leans on his actual shots there, and on a broader average when he has few:

zone make % = (his makes + 15 × the broader average) ÷ (his attempts + 15)
A player who went 2 for 2 from the left corner, where the broader average is 38%, is treated as a 45% shooter there, not 100%. At 40 for 100 he's 40%: his own numbers dominate.
The surprise elementA small random shooting swing, bigger for players with little playoff history.

Big moments aren't that predictable. In each simulated timeline, every player gets a small random swing on his shooting, bigger when he has little playoff history behind him, and capped at ±5 percentage points. A player with a small hot sample can show up hot in some timelines without taking over.

typical swing = 5 points × 40 ÷ (40 + his playoff shots)
No playoff shots: swings up to about ±5.0 points. 40 playoff shots: about ±2.5. 300 playoff shots: about ±0.6.
How each possession plays outSeven steps, from the foul decision to the rebound.

The sim plays possession by possession until the game is decided, overtime included. Each possession goes like this:

  1. The defense decides whether to foul (see late-game decisions below).
  2. Getting into the offense. Bringing it up from the backcourt takes 4–6s; a trailing team late in the game pushes it in 2.5–4s. After a timeout late in the game, the ball is advanced and the inbound takes 0.8–1.6s. With under 1.5s left and no time to cross half court, it's a heave.
  3. Who shoots. Stars get the ball, and a player who's hot that game gets it a bit more:
    his chance to take the shot  ∝  his usage × his hot hand
    
    hot hand = 1 + 1 × (his shooting this game − his usual shooting) × (shots ÷ (shots + 5))
               kept between 0.7× and 1.4×
    In crunch time, stars take over. In the last 5 minutes of the 4th quarter or overtime with the score within 5 (the NBA's "clutch" definition), "his usage" becomes his real clutch usage that season, trusted by his clutch minutes, and his regular-season usage when there isn't enough:
    crunch-time usage = trust × his clutch usage + (1 − trust) × his regular-season usage
    
    trust = his clutch minutes ÷ (his clutch minutes + 60)
    For a 45% shooter: 2 for 2 tonight → ×1.16. 8 for 10 → ×1.23 (more shots, more trust). 1 for 5 → ×0.88. The player you swap in comes in neutral (×1.00), since he didn't play in that game. Research on whether shooters actually stay hot is mixed, so the hot hand mostly decides who gets the ball; it only nudges whether it goes in (by 0.03 × the boost above 1).
    LeBron James in 2015–16 used 31% of the Cavs' plays normally and 43% in 126 clutch minutes, so in crunch time the sim gives him 39.1%. Tristan Thompson fell from his usual share to 9% in the clutch.
  4. From where. His own mix of shots by zone. When only a three will do (down 3 with one possession left, or down 4+ at the very end), only threes, and the ball goes more to players who take threes.
  5. Does it go in.
    make chance = his zone make % × the defense on the floor (+ hot-hand nudge + surprise swing)
    
    defense on the floor = the five defenders' points allowed per 100 ÷ the league's, kept between 0.9 and 1.1
    Good defenses push the make chance down by up to 10%; bad ones push it up by up to 10%.

    Playmaking. Take a creator off the floor and two things happen: the team scores less, and everyone else's shots get harder because the defense isn't focused on him anymore. Every player-season has an offensive lift: how many more points per 100 possessions his team scored with him on the floor than off it (the NBA's on/off splits, from 2007–08; estimated from his own usage, efficiency and passing before that). With no swap, nothing changes.

    change = (lift of the player coming in − lift of the player going out) ÷ the league's points per 100
    
    teammate's make chance × (1 + 1 × change × (his share of assisted makes ÷ 0.6))
                             kept between 0.85× and 1.15×
    Swap out LeBron James 2015–16 (the Cavs scored 114.0 per 100 with him, 98.6 without: +15.4) for a player at −2. A spot-up shooter with 90% of his makes assisted shoots ×0.85; a self-creator at 40% assisted shoots ×0.89. The player you swap in keeps his own shooting.
  6. Fouls and turnovers. A shot draws a foul based on how often he gets to the line; threes draw fouls far less (×0.3). Fouled on a make is an and-one. Turnovers happen at the team's usual rate, and 50% of them are steals.
  7. Rebounds.
    offense gets the rebound = their five's offensive rebounding ÷ (their five's offensive + the defense's defensive rebounding)
    After an offensive rebound, the score decides: if they need a three, they kick it out; otherwise a big man under the rim puts it back (a player is a "big" if at least 35% of his shots come at the rim), and anyone else resets the offense. On a missed last free throw, the offense gets it back 12% of the time.
Late-game decisionsFouling, clock management, timeouts, and the rules of the era.

"Late" means the last 2 minutes of the 4th quarter or overtime. Fouling follows what NBA teams actually do:

SettingValueWhat it does
Up 3, more than 10s leftNever foulPlay defense. Fouling early lets them make both, foul back, and get another shot at a tying three.
Up 3, 6–10s left15%Sometimes foul to take away the tying three.
Up 3, 6s or less50%Often foul. Overall this lands near the ~34% NBA teams foul up 3 in the final 10 seconds.
Trailing, other team has the ballFoulWhen the game clock is under the shot clock (they can just hold it) and the deficit is still reachable, within the last 60s.
Up bigDefendNo reason to foul.

Clock management: a trailing team works 3–8s after crossing half court and shoots leaving 2–4s for a rebound or a foul. A tied team holds for the last shot, shooting with 1.2–3.5s left. A leading team runs the shot clock down to 1–5s, and dribbles it out when the game clock is shorter than the shot clock.

Timeouts start from each team's real count at that moment, by that era's rules. A trailing or tied team uses one late to advance the ball past half court. Each overtime adds 2.

Rules of the era come with each season: for example, the shot clock resets to 14 after an offensive rebound from 2018–19 on, and in 1996–97 the three-point line was 22 feet all the way around.

How results are countedHistory changed means the real loser wins, compared against the real lineup.

Every timeline plays to the end of the game, up to 4 overtimes. History changed means the team that really lost wins. For Ray Allen's moment, any Spurs win changes history; any Heat win keeps it.

Some real endings were long shots, so luck alone can change history in a lot of timelines. That's why every run also simulates the real lineup with the same random draws, and shows the difference: that difference is what your swap did.

Every timeline is seeded: the same moment, the same swap and the same seed always play out exactly the same way.

Every settingEvery adjustable number, explained.

Every adjustable number the simulation uses. The ones marked STARTING VALUE are first guesses that will be tuned by checking no-swap simulations against how real games ended.

SettingValueWhat it does
Playoff trust300 minSTARTING VALUEPlayoff minutes at which his real playoff stats and his projection count equally.
Zone trust15 shotsSTARTING VALUEShots from a zone at which his own make rate and the broader average count equally.
Step-up trust600 minSTARTING VALUEPlayoff minutes at which his personal step-up is half-trusted.
Step-up limits0.6×–1.6×STARTING VALUEStep-ups outside this range are treated as noise.
Surprise swing±5 ptsLargest random shooting swing a player can get in a timeline.
Surprise half-point40 shotsSTARTING VALUEPlayoff shots at which the swing is half its largest.
Hot-hand strength1STARTING VALUEHow much shooting above or below his usual tonight shifts his share of shots.
Hot-hand half-point5 shotsSTARTING VALUEShots tonight at which the hot-hand signal is half-trusted.
Hot-hand limits0.7×–1.4×STARTING VALUEA nudge, so stars still lead.
Hot-hand make nudge0.03STARTING VALUEHow much the hot hand shifts whether it goes in.
Crunch time5 min, within 5When clutch usage takes over (the NBA's clutch definition).
Clutch trust60 minSTARTING VALUEClutch minutes at which his clutch usage and his regular-season usage count equally.
Playmaking strength1STARTING VALUEHow strongly a change in the lineup's offensive lift moves teammates' shooting.
Typical assisted share60%STARTING VALUEPlayers assisted more often than this rely more on creators.
Playmaking limits0.85×–1.15×STARTING VALUEMost a teammate's shooting can move from a swap.
Defense limits0.9–1.1STARTING VALUEMost the defense on the floor can move make chances.
Late game120sWhen late-game rules (fouling, timeouts, clock management) kick in.
Heave1.5sBelow this, with no time to cross half court, it's a heave.
Threes fouled×0.3STARTING VALUEHow much less often a three draws a shooting foul than a two.
And-one×0.4STARTING VALUEMake chance when fouled on the shot, relative to unfouled.
Steals50%STARTING VALUEShare of turnovers that are steals (the ball stays live).
Free-throw rebound12%STARTING VALUEOffense gets a missed last free throw back.
Big man35%STARTING VALUEShare of shots at the rim that makes a rebounder a putback threat.
Overtimes4Most overtimes a timeline can go.
Bring-up (backcourt)4–6sSTARTING VALUETime to get the ball past half court.
Bring-up (trailing late)2.5–4sSTARTING VALUESame, when they're hurrying.
Inbound (frontcourt)0.8–1.6sSTARTING VALUEAfter a timeout advances the ball.
Normal possession8–18sSTARTING VALUEHow long a possession runs before a shot.
Trailing work / reserve3–8s / 2–4sSTARTING VALUETrailing late: time spent before shooting, and time left for a rebound or foul.
Last shot1.2–3.5sSTARTING VALUETied late: shoot with this much left.
Leading: shot clock left1–5sSTARTING VALUELeading late: shoot with this much on the shot clock.
Intentional foul1–3sSTARTING VALUETime it takes to commit a foul.
Putback / kick-out0.5–1.2s / 1–2sSTARTING VALUEAfter an offensive rebound.
Rebound gather0.3–0.8sSTARTING VALUETime for the ball to come down.

Want the full technical version? The engine is open source, and every calculation is documented with formulas and real examples in the project README. Or go try a swap →