While on vacation I wrote some spreadsheets that would calculate the odds for different dice variations of the board game Risk. One of the variations is to use an extra die on defense or attack which I was able to calculate, but Excel doesn’t have enough rows to run all the possible rolls if both the attacker and defender have an extra die. Plus, every spreadsheet took some work and there get to be a lot of different combinations that I didn’t want to run, though I still wound up with 27 different spreadsheets. I knew the best thing to do would be to write some kind of program that would let you input the different options and then have it calculate the odds for you. I had tried this once before, but I don’t know if I finished it. When I pulled it up, it didn’t seem to work.
Computers make this kind of thing easy. If you have 5 dice, you can do For:Next loops of 1 to 6 for each dice, then nest the loops to try out all the different combinations. If you want to do 8-sided dice, you change the loops to run from X to Y where X is 1 and Y is 8. Or any other number. Then you keep running totals and give the answers when all the iterations have run their course. But it still took a few nights of working on the project before I started making real progress.
Once I got it working, I used my spreadsheets to check the math in the program. After I got the bugs worked out, everything was agreeing perfectly except when the attackers had an additional die. I narrowed the problem down to a bad formula on the spreadsheet! So it was kind of good to have an independent check. I went back and fixed the blog posts that had the numbers wrong.
I compiled an executable that can be used in Windows, but it doesn’t do the Fighter correctly from Star Wars Risk where you can replace a 1 with a new roll (you can enter the lower limit of the dice as 2 instead of 1 and it will be kind of similar). And it might be neat to turn the program into something that would do the rolling for you when you have big masses of armies facing off. You could enter the number of attackers and defenders and let it roll a certain number of times or until one side loses and it could generate all the rolls randomly and print a tape of all the battles and results.
Anyway here is a page I made where you can download the program.
Time for an iPhone app?
Tedward. The first sentence of this post is frameable.
Why are you not on Facebook?