⚽
WorldSim Cup
fifa-hack · built on Vercel
A presentation
Can the USA
win the World Cup?
A MiroFish agent swarm that Monte Carlo–simulates the USA's gauntlet to the title — and streams the whole prediction back, live.
Next.js 16 · React 19
Claude · AI SDK v7
Supabase · Resend · Auth0
worldsim-cup.vercel.app
Where it started
I saw this, and
thought: “what are
the actual odds?”
A viral @Novig post laid out the USA's brutal hypothetical road to the World Cup. Everyone argued about it. Nobody had the number.
So I built the thing that would actually compute the odds — and let you watch a swarm of agents run it.
3.2M views one tweet · one bracket · one question
the post that started it — drop the real shot at /novig-tweet.png to swap in
The gauntlet
Five teams stand in the way.
The fixed bracket the whole app is built around. Win all five — or the dream ends.
🇧🇦Round of 32
Bosnia
59% USA win
🇧🇪Round of 16
Belgium
43% USA win
🇪🇸Quarterfinal
Spain
39% USA win
🇫🇷Semifinal
France
35% USA win
🇦🇷Final
Argentina
37% USA win
The method · MiroFish swarm
Don't guess the bracket. Simulate it.
Modeled on MiroFish — a swarm-intelligence prediction engine. One click runs a five-stage lifecycle: a graph of the world, a swarm of player agents, thousands of simulations, and an agent that writes the verdict.
1
Graph Building
Extract entities — teams, players, the bracket path — from the seed.
2
Environment Setup
Spin up a player agent per athlete, persona seeded from real attributes.
3
Simulation
2,000 Monte Carlo runs / round + one featured champion playthrough.
4
Report Agent
Reads the sim logs and writes the title verdict — Monte Carlo as an agent.
5
Persist & Recap
Saved to Supabase; a recap email goes out via Resend.
The design principle
Agents narrate.
Deterministic code computes.
⚙ Deterministic code owns
The numbers
- Goals, winners, penalties — from a seeded engine
- Monte Carlo odds, reproducible every run
- Every run written to the database
✦ Claude owns
The voice
- Player-agent personas & trash talk
- Live commentary on each match
- The ReportAgent verdict + recap email
An LLM can't run 2,000 sims and be trusted. So it never decides a score — it only tells the story.
Under the hood
Why the odds are trustworthy.
No vibes — a real expected-goals model, sampled thousands of times.
2,000
sims / round
Conditional win % per opponent, multiplied into a cumulative title chance.
xG
Poisson model
Expected goals from each side's attack ÷ defense, then sampled to a scoreline.
1 seed
fully reproducible
mulberry32 RNG — same seed, same tournament, every single time.
const xg = BASE_XG * Math.pow(attack / defense, SENSITIVITY); // then poisson(xg, rng)
The answer
Survive all five? 1.2% of the time.
Even favorable single games compound. Watch the USA's survival decay round by round.
1.2%
USA title odds
cumulative — the product of all five rounds
🇧🇦Bosnia59% alive
🇧🇪Belgium25% alive
🇪🇸Spain9.8% alive
🇫🇷France3.4% alive
🇦🇷Argentina1.2% champions
✦ The wow moment
You watch the swarm think.
One button opens a live console. The five-stage MiroFish lifecycle streams as NDJSON — reasoning, tool calls, and results scrolling in real time.
1
Graph Building
entities from the seed — 6 nations, 20 players
2
Environment Setup
player agents spun up, personas from attributes
3
Simulation Execution
2,000 Monte Carlo runs + the featured run
4
Report Generation
the ReportAgent reads the logs & writes the verdict
5
Persist & Recap
save to Supabase, email via Resend
MiroFish Swarm Agent · live
▸ Graph Building
buildKnowledgeGraph ✓ 6 nations · 20 players
▸ Simulation Execution
runMonteCarlo ✓ title odds 1.2%
simulatePlaythrough ✓ USA win the cup 🏆
▸ Report Generation
saveToSupabase ✓ saved row
sendRecap ✓ emailed
writing the verdict▋
The architecture
Five services, one thin client each.
▲
Next.js 16 on Vercel
App Router · React 19 · streaming NDJSON routes
🎲
Deterministic sim engine
Poisson xG · seeded RNG · Monte Carlo
⟳
MiroFish orchestrator agent
AI SDK v7 · 5-stage lifecycle · streams NDJSON
✦
Claude — Haiku + Sonnet
personas (parallel) · the ReportAgent verdict
⛁
Supabase
every run persisted — sim_runs
✉
Resend + Auth0
recap email · non-blocking login
// one POST, an NDJSON stream
browser ── click ──▶ /api/agent
├─▶ buildKnowledgeGraph()
├─▶ generatePersonas() ·· Claude
├─▶ runMonteCarlo(2000)
├─▶ simulatePlaythrough()
├─▶ reportAgent() ······ Claude
├─▶ saveToSupabase()
└─▶ sendRecap() ········ Resend
▼
events stream back, live
The payoff
From a tweet to a verdict — in one stream.
🏆
Live title odds from thousands of sims, a champion run you can replay goal-by-goal, and a Claude-written verdict — all from one click.
📊 Live Monte Carlo odds
⚽ Goal-by-goal match feed
🧠 Claude-written verdict
✉️ Recap email delivered
Deterministic where it counts.
Generative where it delights.
A prediction you don't just read — you watch a swarm run it, live, end to end.