Mathematician Alfré Rényi famously said that “a mathematician is a machine for turning coffee into theorems.” Waterloo biostatistics professor Michael Wallace, however, is a machine for turning coffee into prizes.

In 2020, when Tim Hortons moved their long-standing “Roll Up The Rim To Win” contest completely online due to the Covid-19 pandemic, Wallace made the news for using his statistics knowledge to win 98 per cent of the time.

“I’ve always been interested in contests and games,” he says, so when he found out the annual contest was moving online, he saw it as an analytical challenge. “Games of chance involving physical objects are really robust in their defense against cheating,” he explains. When Tim Hortons handed out prizes through physical cups distributed across the country, the chances of winning were fairly consistent: you either received a winning cup, or you didn’t.

When they moved to an online system, however, things changed. “The way the game works now,” he explains, “is that every single prize is associated with a winning time frame – a tenth of a second – and all the time there are little windows opening and closing. You buy your coffee, but you don’t roll up immediately – you choose when to play the roll.” This introduced an element of strategy: if he could guess when less people were playing, he had higher odds of winning.

Wallace also figured out that there was a flaw in Tim Hortons’ system. If a prize wasn’t won, it was randomly distributed later in the contest. This created a snowball effect: by the last day of the contest, there would be far more prizes available than average. He waited till 4:30 a.m. on the last day of Roll Up To Win, and played all 96 of his accumulated coffees, with excellent results: Wallace won 67 free drinks and 27 donuts.

He was so successful, in fact, that Tim Hortons reached out to him to find out how he’d won – and promptly fixed the flaw in their system! “They were very kind,” he laughs, “despite the fact that I probably caused some pretty stressful meetings.”

Over the next two years, Wallace continued to play Roll Up To Win with less dramatic results – mostly so he could keep using the contest as an example for his introductory Statistics course. Then, this year, Tim Hortons introduced a new feature on their website that showed the number of prizes being won in real time, and Wallace saw an opportunity to do some number crunching. With the help of a couple friends, he started manually collecting data on when people won the most often (the contest rules explicitly forbid using a computer script). 

“From a statistical perspective, we had a problem with missing data,” he says. “I couldn’t be checking the website full time – I have a job, and despite all that coffee, I do sometimes sleep.” But the data they gathered gave them a “skeleton,” from which they could fill in the gaps. He found that the statistically best time to play Roll Up To Win was 3:16 a.m. ET. When he played his rolls at 3:16 a.m, he had an 80 per cent win rate: not as good as in 2020, but still impressive.

The worst time of day? 11:46 a.m. ET. “Canada is a really, really big country, with different time zones,” he explains. At 11:46 a.m. ET, people in Ontario are starting to go out for lunch, whereas people on the west coast are getting their morning coffee on the way to work.

Despite having fun with Roll Up To Win, Wallace has no ambitions of winning an expensive vacation or a new car. Instead, he sees his winning strategy as evidence of the everyday applications of statistics: “I really like the fact that you can take data from the real world, run it through some math, and find patterns that describe what you see. It’s a kind of magic.”