Skip to content
Back to projects

nfl play design and simulation

PocketPlay.

TAMUHack 2026 · 3rd Place, NorthMark Compute & Cloud · Best Beginner Software Hack

NFL mode with a Bills and Dolphins matchup. The routes are laid out on the field and the play simulator panel sets the scheme and game situation.
NFL mode with a Bills and Dolphins matchup. The routes are laid out on the field and the play simulator panel sets the scheme and game situation.

PocketPlay is an app for designing and simulating NFL plays. You can sketch your own play and see how it performs against a defense, or pick a real matchup and simulate thousands of games to estimate who is likely to win.

The two modes

  • In coach mode you draw a formation and routes on a 2D field, pick a defensive scheme to run it against, simulate the play, and save it to your account. The app also returns AI suggestions for how to improve it.
  • In NFL mode you pick two real teams and configure the matchup with team strengths, injuries, weather, and coaching tendencies. It simulates thousands of full games and reports win probability, score distributions, and which factors mattered most.

How the simulation works

Both modes run on a Monte Carlo engine I wrote in TypeScript. Simulating a play thousands of times produces a range of outcomes rather than a single number, which is what makes the results meaningful. The play engine and the game engine are separate, since one works rep by rep and the other works down by down.

  • Results stream back to the browser as reps finish, so the dashboard fills in progressively instead of waiting on one long request. I wrote a hook called useSimulationStream to handle the reading side.
  • Runs are seeded, so the same inputs produce the same results. That reproducibility is what makes the Vitest tests over the engine worth having.
  • API inputs and outputs go through shared Zod schemas, so a malformed request or model response is caught at the boundary rather than further down in the UI.

Where the ratings come from

The team and player ratings are derived from real data rather than hand tuned. A Python script fits team ratings from nflfastR play by play data, and a second script compiles the Madden 26 ratings CSV into a lookup table. Both are saved as JSON and committed to the repo, so the app ships with the data already in place and makes no external calls at request time.

The AI suggestions

Play suggestions go through the Vercel AI SDK to OpenRouter, using Gemini 2.0 Flash. The prompt includes the formation you drew, the defense you selected, and the simulation results. If no API key is set, the route falls back to a deterministic mock response so the feature still works end to end for anyone who clones the repo.

next project

EvoEmu

Directed evolution for proteins