Question text is in black, my answers in blue.
Since this is a dice problem, where five independent six-sided dice are thrown
for the attack, the atomic events are sequences, with one value for each of the
five dice. You need to somehow consider all these sequences and count how many
fit into each of the five categories -- attacker loses two, lose one each, or
defender loses two. One way to do this with a computer is to just cycle
through all possible sequences and categorize each one. Another way (the only
way to do it by hand, as far as I know) is to break up the sequences into
groups with the same highest attacker die and same second-highest attacker die,
then count the sequences of each category in each group. For example, if the
attacker's two highest values are 1 and 1, then the attacker's third die is
also 1, and there is only one sequence of attacker dice making this happen. And
in this case all 36 values of the defender's two dice lead to the attacker
losing two armies.
Amazingly, the Wikipedia
article on the game of Risk still appears to have the correct probabilities
that I put there on 10 March 2009. You can use these to check your work, but
of course they are not definitive. Some of the references in the Wikipedia
article are also worth reading.
AtBatIterator
might give a -1 to indicate that the batter
walks. But the original problem in the book doesn't say anything about walks.
Yes, that's a mistake, and you should assume that the
AtBatIterator
only gives you values in the set {0, 1, 2, 3, 4}. I
was thinking of a program that would also calculate on-base average,
which is (roughly) (hits plus walks) / (at-bats plus walks). I'll change the
assignment page.
No. The attacker's lowest die does not matter. For the defender to lose two, the attacker's best die must be better than the defender's best, and the attacker's second-best must be better than the defender's second-best.
When do they lose one each?
When the attacker's best is better than the defender's best, or the attacker's second-best is better than the defender's second-best, but not both.
So the attacker loses two if neither of those are true -- if the defender's best is equal to or better than the attacker's best, and the defender's second-best is equal to or better than the attacker's second-best?
Yes, that's right.
I still don't see how to work out the probabilities.
As I said above, there is a case for each possible sequence giving the values of the five dice. You can either just check each case individually with a computer, or group them by the values of the attacker's best, attacker's second-best, and so forth.
Last modified 8 October 2009