# Imagine speedrunning Risk

Could you imagine speedrunning a long board game? For some reason, I have been.

I've always watched speedruns through streams like Games Done Quick, [European Speedrunner Assembly] (https://www.youtube.com/user/EuroSpeedAssembly), or RPG Limit Break. The short ones are nice for some quick entertainment, while the longer ones are good for background noise.

Some of these runs can be really difficult to execute, while others can be a little more trivial. Some runs can play out the exact same way every time, and some can vary wildly due to random number generation.

In the past few months, I've started speedrunning games that require lots of dexterity, really short, and vary wildly with RNG.

The first speedrun that I've been grinding is Google Solitaire. Seeing EazySpeezy's video made me realize how accessible it really is, especially since it's on a mobile device. The run is pretty easy to pick up, you just need to:

- Rapidly tap the deck with your left hand to auto place cards
- Play normal solitaire with your right hand
- Place enough cards that the rest are automatically sorted and you win

Here's how my runs progressed over time:

Date | Time | Video |
---|---|---|

2020-12-28 | 1:06 | https://youtu.be/9FiUXyQNERc |

2020-12-28 | 0:58 | https://youtu.be/UHKvGBV80A4 |

2020-12-28 | 0:55 | https://youtu.be/WzvKL7R5cgA |

2020-12-28 | 0:49 | https://youtu.be/BeBYhNyj1rs |

2021-01-15 | 0:45 | https://youtu.be/muNoTDBgvy8 |

2021-01-16 | 0:42 | https://youtu.be/3uLyCwwxmkk |

2021-01-20 | 0:38 | https://youtu.be/VHxR6ptCPJ8 |

2021-01-27 | 0:36 | https://youtu.be/wee4XkQ54CE |

2021-01-28 | 0:35 | https://youtu.be/5OBpHmFp7hk |

2021-01-29 | 0:33 | https://youtu.be/YEKMZJyxb8c |

2021-01-29 | 0:31 | https://youtu.be/Ys_qBiVrz-0 |

At the time of writing, the world record for a *No Glitches Easy Touchscreen* speedrun is 0:21. For comparison, my run is 7th place for that category!

I really enjoyed speedrunning Google Solitaire because it was easy and short to pick up. I would frequently play it while waiting for my toddler to fall asleep or just while I was in-between things. My phone has a screen recorder built it so it was almost trivial to start a run. The randomness also kept each run different (though most of the strategy was mashing).

While I was running Google Solitaire, I came across the respective Google Speedrunning Community Discord Server, which linked to the Mobile Speedrunning Discord Server. There was a whole community of people running tons of different games just on their phones.

I kept my eye out for another similar game to speedrun (short run, lots of RNG, can run on my phone). This announcement went out on the Mobile Speedrunning Discord and it piqued my interest:

Hello peeps! Fioresa has announced that he will be hosting a bounty of a $100 google play/apple store gift card, as well as other gift cards (steam, etc.) or potentially even nitro totaling $100 to the first person to get a 1 round world record in the final stand stage of Risk Mobile! It's been over 12 hours since he mentioned this but I think it's appropriate to formally inform you all about this because potential for money right? For those who are interested, best of luck, and most importantly, have fun! Leaderboard: https://www.speedrun.com/risk_gd#Final_Stand

A speedrun for Risk? Like, the board game? I was confused, but I took a look at the world record and it looked like exactly I was looking for. The bounty was placed to get a world record time (~30 seconds) while also completing the scenario in one round. The speedrun involved:

- Rapidly clicking on territories to place armies and attack
- Mashing the enter key to complete attacks
- Hoping that your dice rolls are good enough to win in one round

Completing the Final Stand scenario in one round is so incredibly hard that it's only been accomplished once. I was up for the challenge though!

I practiced it on my phone for a while, but didn't find any success. I tried some more on my computer, but still didn't find any success. I practiced on a different level and got a pretty respectable time of 0:16, only two seconds away from the world record.

I felt confident that I had the dexterity to execute the run. I came close a couple of times. My best run would have been a ~15 second run, which is almost half of the current world record!

I got curious though - is this run feasible to achieve? Other speedruns have had their probabilities calculated... I wonder how hard this one is!

I did some searching online but most of the analysis wouldn't apply - unlike normal Risk, the opponent armies lose ties when they're defending. It turned out I would have to do my own independent analysis!

Despite having a degree in Mathematics, calculating the exact probability for this entire run is too hard for me, especially since there's multiple decision paths. A "good enough" calculation would be for me to just simulate it a million times and get the rough probability.

So that's what I did! I wrote the Last Stand Simulator. It simulates a smaller portion of the entire run where there's no decisions to be made - the last run of attacks.

Using the simulator, I did some calculations and came up with a 0.033% chance of winning the final attacks in my route. My best run so far had a 0.257% chance of succeeding. Looking at the only recorded example of finishing in one round, that route's probability seems a little better at 0.049%.

## Full calculations

Hello fellow math nerds! Here's all the details.

Keep in mind that these are rough calculations and my methodology might be flawed in some examples.

Here's a simulation of the worst case for the run:

```
Running simulations for the following attack:
Fighting: 26 --> [8, 31, 43, 58]
We ran 1,000,000 simulations and won 332 times.
Simulated probability of winning is 0.033%
```

0.033% is *really* rough. 332 times in a million doesn't sound like something I want to try. That's the worst case scenario though, what if I make up a nicer example:

```
Running simulations for the following attack:
Fighting: 26 --> [8, 20, 30, 40]
We ran 1,000,000 simulations and won 37,648 times.
Simulated probability of winning is 3.765%
```

More than 3% is a little better! My numbers were kind of made up though. What if I analyze the best run I have so far?

```
Fighting: 26 --> [8, 30, 10, 32, 39]
We ran 1,000,000 simulations and won 2,573 times.
Simulated probability of winning is 0.257%
```

Ouch... my best case run still had pretty terrible odds.

What about the only recorded one round Last Stand? It had a comparatively easier last run of attacks:

```
Running simulations for the following attack:
Fighting: 36 --> [8, 33, 31, 2, 32, 10]
We ran 1,000,000 simulations and won 92,980 times.
Simulated probability of winning is 9.298%
```

However, if you take it in the context of the entire run, the overall odds of that run are in line with what we expected before. I modified my simulator to take that route into account and came up with a similar probability:

```
Running simulations for the following attacks:
Fighting: 19 --> [50, 58]
Fighting: 36 --> [8, 33, 31, 2, 32, (58-?)]
We ran 1,000,000 simulations and won 494 times.
Simulated probability of winning is 0.049%
```

It seems like the route I was using is suboptimal and I should be using the technique from the other runner. I'm going to extend my simulator more to come up with the optimal route for this specific speedrun!

Writing good enough tools to support your work can be helpful. This tool took me less than an hour to write, but it may make the difference between finding an optimal route that leads to claiming the bounty and just giving up.

If probability calculations like this interest you, then you might also enjoy this extreme example of a tool used to solve the worst mini-game in a Legend of Zelda game.