How the match engine works

Most sports simulators decide a result and then write a scoreline to fit it. This one bowls the ball.

The first version of this engine was handed a win or a loss, invented a score that fitted, and shared that total across the eleven. It had the direction of causation backwards, and everything wrong with it followed from that single decision.

Two sides with the same average made the same runs, so an eleven built around Chris Gayle and AB de Villiers scored exactly what an eleven of accumulators scored. The bowler at the other end never entered into the calculation at all. And because the result came first, a side of the best players in the archive could lose to a modest one for no reason a viewer could see.

The direction, reversed

Before: a coin decides the result, a score is invented to fit, the card spreads that total across the eleven. Now: every delivery is bowled, the card is read off them, and the result is whatever the second innings did.

Nothing decides the outcome. It is the residue of about 250 deliveries, each one a contest between two named players.

What is decided on each ball

Pace and spin are different problems

Every batter carries two batting ratings: one against pace and one against spin, computed from 4.5 million deliveries classified by the bowler’s own stated style. Chris Gayle in 2018/19 comes out at 55 against pace and 99 against spin. Irfan Pathan in 2011 is the exact reverse.

Forty-six per cent of players differ by eight rating points or more between the two. It is the argument every cricket conversation about a batter arrives at within a minute — he cannot play spin, he is uncomfortable against genuine pace — and until it was measured, a turning pitch meant nothing to any particular player.

Catches go down

Roughly one chance in thirty is dropped, weighted by what the fielding side actually caught per match, and a drop is a life. The rate matters more than it looks: at one chance in ten the better side lost twelve percentage points of win rate, because it creates most of the chances and therefore forfeits most of the drops. An attack that keeps beating the bat has to be worth having.

Bowlers tire

A spell is consecutive overs, and the fourth of them is not the first. Pace drops, length goes, and about a run an over comes off it. That is the whole reason a captain rotates an attack rather than bowling his best man straight through, and without it there was no cost to doing exactly that.

Rain, and a revised target

About one limited-overs match in twenty is interrupted, likelier under an overcast sky than a clear one. When rain takes overs off a chase, the target is revised upward per over rather than scaled straight down — a side with all ten wickets and half its overs has far more than half its scoring left in hand. That is the idea behind Duckworth-Lewis, and it means a side can win having made fewer runs than the other.

A Test can be drawn

A captain declares; he does not run out of overs. A side bats until its lead is enough and until enough of the match remains to bowl the opposition out, and those two pull against each other — every over batted is an over unavailable for taking ten wickets.

And a fourth innings is not always a chase. Four hundred to get with a day left is not a target, it is a warning, and a side in that position blocks. Without that behaviour a Test was drawn three times in a hundred; with it, twenty-five, which is Test cricket.

Form moves through a season

A season is not eleven players at their average, eleven times over. Somebody is in the form of his life by the sixth game and somebody has not middled it since the first — and both come out of what has actually happened rather than a dice roll before each match. A hundred pulls a man out of a trough; three failures put him in one.

Class tells further the longer the game is

The same gap in ability is worth more over fifty overs than twenty, and more again over five days. It is why Twenty20 is the format upsets live in — there is not enough of it for the better side to be proved better, which is close to why it was invented. Without this, a one-day match came out flatter than a Twenty20, which is backwards.

What the engine produces

MeasureTwenty20One-dayTest
Par score160262384
Run rate, powerplay8.25.2
Run rate, middle overs8.55.13.1
Run rate, death12.26.8
Matches drawnnonenone25%

None of those is a target the code aims at. Each is what came out of playing the deliveries, and each is checked against thousands of simulated matches on every change.

The card cannot lie

Because there is only one account of a match, a bowler’s figures of 4-0-22-3 are his four overs and his three wickets. Nothing is shared out afterwards to make the totals agree, and the ball-by-ball replay you can watch is the same innings the scorecard describes rather than a reconstruction of it.

More on how this is built