![]() | Bovada is the only Internet casino endorsed by the Wizard. Here are my reasons why and my promise of support. |
Probabilities in Dice Wars
| December 10th, 2011 at 9:01:00 AM permalink | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Wizard Administrator Member since: Oct 14, 2009 Threads: 313 Posts: 6784 | We've discussed the very-addictive game Dice Wars before. We used to have a tournament, which petered out. The purpose of this post is to address the probability of an attacker victory given any given number of dice for both attacker and defender, as follows. The number of defending dice is along the top row. For example, if the attacker has 5 dice, and the defender has 4, the attacker has a 71.8% chance of winning.
The next table considers the question of the greatest expected gain by number of dice. This is the expected number of armies you beat less the expected number you lose. For example, in the same 5 vs. 4 case, you can expect to gain 1.744624 dice relative to the enemy after the battle.
It is interesting to note that in an 8 vs. 8 battle, even though the attacker loses on ties, it is still a net gain to attack, because if you lose, you only lose 7 dice, because one is left from the attacking territory. Then again, the one army will likely easily be taken the enemy's next turn, but I didn't want to over-think it. So, the greatest expected gain is attacking with 8 against 5. Any other math questions pertaining to Dice Wars? It's not whether you win or lose; it's whether or not you had a good bet. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| December 10th, 2011 at 11:43:07 AM permalink | |
| JB Administrator Member since: Oct 14, 2009 Threads: 309 Posts: 906 | Interesting analysis, thank you. |
| December 10th, 2011 at 1:41:57 PM permalink | |
| Mosca Member since: Dec 14, 2009 Threads: 74 Posts: 1628 | There seems to be a strong belief around the internet that the programming suppresses the human's dice as compensation for its weak sense of strategy. Also, most people don't care enough to run the number of trials needed to test it. I think that it suppresses the dice, and I don't care enough to check it. NO KILL I |
| December 10th, 2011 at 7:18:01 PM permalink | |
| Mosca Member since: Dec 14, 2009 Threads: 74 Posts: 1628 | I just tossed 3 against 3 four times in a row, with the defender being the last stack on the map. I lost all four. I rolled 3 sets of between 6 and 9, and on the fourth roll I rolled a 14 and the defense rolled a 17. I know, I know. My mind invents a story. But I'd like the answer. I thought it was fishy enough to google it, and find that lots of folks agree. NO KILL I |
| December 11th, 2011 at 2:34:12 AM permalink | |
| JB Administrator Member since: Oct 14, 2009 Threads: 309 Posts: 906 | There is a way to confirm or reject such claims: disassembling the Flash applet and analyzing the code. If I have the time and urge, I might try to do that. |
| December 11th, 2011 at 2:59:17 AM permalink | |
| odiousgambit Member since: Nov 9, 2009 Threads: 174 Posts: 2415 | I am quite attuned to how computer games cheat, for some reason really bothered about it. I have blogged about it. The favored way a programmer will have the computer cheat is to manipulate the reinforcement phase and initial strength phase. It doesn't seem Dice Wars does that. I realize to say what I say next has no more weight than to say the opposite or anything based on what "it seems", but the frustrating luck the bots have in that game sometimes still to me seems to fit the pattern I see in other games that would seem honest. One thing for sure, as I have learned from one naval warfare game where combat can be resolved by same results each time [non-random], it is boring to set a game like that. Even when strategy is the goal and when you want to minimize luck. My 2 cents. "Baccarat is a game whereby the croupier gathers in money with a flexible sculling oar, then rakes it home. If I could have borrowed his oar I would have stayed." Mark Twain |
| December 11th, 2011 at 4:16:46 AM permalink | |
| JB Administrator Member since: Oct 14, 2009 Threads: 309 Posts: 906 | I disassembled the Flash applet for the game. I believe the code which selects the dice rolls is located here (sprite 147): dmax = [0, 0]; - dmax[0] contains the number of dice in the attacker's cell - dmax[1] contains the number of dice in the defender's cell - deme[][] contains the array of random dice (0 to 5) for both parties - sum[0] contains the dice total for the attacker - sum[1] contains the dice total for the defender For each die in each party's cell, it picks a random number from 0 to 5 inclusive (and stores it in deme[][]), then adds 1 to it (to get a number from 1 to 6) and adds that to the running sum. So, I think it's safe to say that it is picking the dice rolls fairly. --------- However, I have discovered a flawed shuffling routine in another section (sprite 44), though I'm not sure what it is used for: dl = [0, 1, 2, 3, 4, 5, 6, 7]; After running a simulation using this biased method, here are the 3 most common outcomes for the array after it has been "shuffled": 1. [ 1, 2, 3, 0, 5, 6, 7, 4 ] 2. [ 1, 2, 0, 4, 5, 6, 7, 3 ] 3. [ 1, 2, 3, 4, 0, 6, 7, 5 ] The second for() loop uses the first 3 elements of it, and as a result of the shuffle's bias, those elements will almost always be [0, 1, 2] or [1, 2, 3]. Again, I'm not sure what this array is used for...but I don't believe it has anything to do with the dice rolls. |
| December 11th, 2011 at 8:11:20 AM permalink | |
| Wizard Administrator Member since: Oct 14, 2009 Threads: 313 Posts: 6784 | I think we had this discussion a long time ago about that method of shuffling. It seems to me that position x would have less than a 1/8 chance of having the number x (where x goes from 0 to 7). Did you ever state a good shuffling method that minimizes both bias and time? The way I do it is to swamp two random positions in the array at least as many times as there are positions in the array. About Dice Wars, I would hate to know how many hours, make that weeks, I've played that game, but overall I think the dice rolls are fair. It's not whether you win or lose; it's whether or not you had a good bet. |
| December 11th, 2011 at 8:50:17 AM permalink | |
| JB Administrator Member since: Oct 14, 2009 Threads: 309 Posts: 906 | The shuffling method I use these days looks like this (assume that deck[] has 52 elements, with values ranging from 0 to 51): for (int x = 51; x > 0; x--) |
![]() | Bovada is the only Internet casino endorsed by the Wizard. Here are my reasons why and my promise of support. |
