Risk Board Game Battle AutomationThe ultimate Risk board game program to help streamline long battles, record dice rolls, analyze trends and view regression statisticsAndrew HBlockedUnblockFollowFollowingJun 6Photo by Matthew Guay on UnsplashThere are many Risk fans, like myself, out there.
We have fond memories of conspiring with friends, building alliances, crushing enemies, and, of course, rolling the dice.
We also have memories, particularly towards the second half of the game, where we have to tediously roll for 15 minutes as the game-changing Brazil/North Africa battle unfolds.
Game pieces get knocked over, dice fall on the floor, some people may try and cheat their rolls… At the end of the battle, everyone is jaded and bewildered.
Someone usually is skeptical that the fight was even fair with Johnny rolling three sixes in a row.
When I was in this situation, I always wished there was a way to guarantee the battles were 100% fair and simple.
I wanted data as to how the battle went to use as a reference for the next one.
That’s what inspired me to make this tool.
Below is the code for a Risk battle program.
After inputting the starting attack and defend armies, this tool:Outputs a data-frame with the dice groupings and respective army totals, per roll, that can be exported to ExcelPlots visually what the losses look like for attacker and defenderPlots the normalized trend of lossesPlots the percentage changed for each army per rollOutputs the regression line for the army losses, so you can obtain an average slope (armies lost per turn) for the attacker and defender.
Program and data-frame output:Input the starting armies on lines 10 and 11.
From there, the program has a while-statement, which runs the armies through an if-statement filter.
It gradually runs them down to either 0 for defenders or 1 for the attackers.
During the if-statements, I appended each dice roll and army totals, per roll, to the list variables in lines 13–16.
Below is the output of total_log on line 174:Plots:Total army losses:Normalized army losses — this graph is useful when the attacking and defending armies don’t start at the same values.
Percent change per roll:Lastly, we have the code for the regressions of each army.
The attackers lost an average of 0.
938 troops per roll.
The defenders lost an average of 1.
062 troops in this example.
Hope this helps streamline your games.
Github link for program: https://github.
ipynbInteresting article on Risk with great probability table: https://www.