Inspiration

England and Wales have a record Crown Court backlog. After taking office in the game, about 80,000 cases were waiting, and prisons were around 98% full. In 2024 prisons got so close to full that the government released some prisoners early, at 40% of their sentence. The two problems fight each other: clear cases faster and you fill the prisons faster. This game shows that trade-off with real data, and make it funny enough that people actually play with it. The theme is "time", and justice delayed is the ultimate time problem.

What it does

Queue Britannia is a satirical game and forecasting tool built on real court and prison statistics.

Survive to the Election: you have 12 quarters (3 years) and a budget. Each quarter you choose courtrooms, funding for fixes, trial overbooking, prison places and, in an emergency, early release. Random events strike, such as barrister strikes, a crumbling prison wing or a police charging surge. A tabloid front page, The Daily Queue, reports each quarter. You lose if the prisons hit 100% or your popularity hits 5. Trial collapse predictor: for each of 70 Crown Courts, it predicts the chance a listed trial cracks or collapses on the day. Smart overbooking ("courts go Ryanair"): a Monte Carlo of court days picks how many trials to list to fill court time without bumping too many. Backlog → remand → prison model: it links court throughput to the remand and prison population, so you can see the prisons fill up as the courts speed up. Sir Humphrey's Autopilot: it simulates 30 possible futures for each of 40 candidate plans and recommends the one with the best expected outcome and the lowest risk of losing. “How we know it works” page: forecasts are tested walk-forward, predicting each quarter using only earlier data and scoring against what really happened.

How I built it

Data: Ministry of Justice Crown Court statistics for 70 courts, quarterly from 2016 to 2026 (receipts, disposals, outstanding cases, and trials listed, cracked and ineffective, with reasons). Also HMPPS / OMSQ prison population, capacity and remand figures. The MoJ files are pivot-table workbooks, so we read the raw records straight out of the Excel pivot cache. Trial collapse model: an empirical-Bayes beta-binomial. Each court's collapse rate is shrunk towards its region's rate, so small courts don't produce wild estimates. Overbooking: a newsvendor-style Monte Carlo using each court's predicted collapse rate with day-to-day variation. Queue and prison model: a weekly queue simulation of the backlog, with Little's law for remand (remand = arrivals × waiting time) and a flow model for sentenced prisoners. Autopilot: a vectorised game engine with common random numbers, so all plans are compared on the same simulated futures. Stack: Python, Streamlit, Plotly, pandas, NumPy and SciPy, plus custom CSS animations for the game screens.

Challenges I ran into

Honest validation: The first backlog "hindcast" looked perfect, because disposals were used as a stand-in for sitting days. It was replaced with a proper rolling-origin backtest. Some things just aren't predictable: whether an individual court's backlog rises over a year is driven by national shocks like Covid and the 2022 barristers' strike. None of the models beat the base rate there. Game balance: early release dominated at first, so the trade-offs had to be made real

Accomplishments that I'm proud of

It runs on real data for 70 courts across 10 years, not a toy dataset. It shows the courts-vs-prisons trade-off, which is genuinely counter-intuitive. It's actually funny. Sir Humphrey stays dry, and the jokes punch at the system, never at victims or defendants.

What I learned

A simple model that's honestly backtested beats a clever one that isn't. Uncertainty matters for decisions. Overbooking only works if you know how variable collapse rates are, not just their average.

What's next for Queue Britannia

Swap in levers whose effects can be measured from history, such as sitting days and recalls to prison, and use realistic prison build times and costs. Replay a real past episode (start in 2022 and apply what the government actually did) to validate the whole simulation. Add a stress test that varies every assumed parameter by ±50%. Add case-level data, with special access, to predict individual trial collapses.

Built With

Share this project:

Updates