Wednesday, August 02, 2006

Dice Wars

I have been addicted to this Flash based game Dice Wars this week. It is pretty similar to Risk. Lots of fun but tough to play just one.

I was having a trouble estimating the odds of winning any given battle, so I decided to figure them out. My probability is a little rusty, so I couldn't figure it out mathematically and had to go all Monte Carlo on this biyotch (I can remember all the the stuff with coins or balls and urns but can't figure out how to do dice).

This table shows the odds of winning a battle. The number of dice the attacker has is on top and number of dice for the defender on the side. A tie goes to the defender.


For example, if you have 5 dice taking on someone with 3 you have a 90.56% chance of winning. This table is really handy when trying to figure out your strategy.

Anyway, the game is good stuff, give it a try.

via Digg

Update: The Kdice Wikispace has probabilities as well, and probably more accurate than the table above.


Anonymous said...

I have found a problem with the numbers above. You show a 100% chance of 8 dice defeating 2 dice, but it's obvious that 8 dice could roll 8,9,10,11 or 12 which is within reach of two dice. I've done the calculations and the percent should actually be .999877 which rounds to .9999 and not 1.

Fat Knowledge said...


Wow, I am impressed! I couldn't remember how to do the math, so I just used the random number generator in my computer and ran like 1 million instances to get close to the real thing. I am not sure how accurate the numbers are, but they are more than good enough for what I wanted to use them for (figuring out what my chances of winning are on a move). I later found this site that has the probabilities, and I bet they are more accurate than mine.

Anonymous said...

Close, but it would have been more accurate to simply run for-loops for every combination and add everything up. would only take moments on a desktop to computer to churn through the tables.

eg: pseudo-code for 2 dice against 3 dice:

wins = 0;
battles = 0;

for a1 =1 to 6
for a2 = 1 to 6
for d1 = 1 to 6
for d2 = 1 to 6
for d3 = 1 to 6
battles = battles + 1
attack = a1+a2
defense = d1+d2+d3
if (attack > defense) wins = wins+1
print 'chance of 2 dice beating 3 dice is' (wins/battles * 100)

This might get a little sluggish testing 8 dice against 8 dice (2.3 billion iterations of the inner loop) so the next optimization would be to build summary tables for each number of dice, but thats another lesson ;)
Happy computing..


Anonymous said...

eeks. i meant 2.3 trillion... so those summary tables would be useful...

Post a Comment

Note: Only a member of this blog may post a comment.