Now we have to work out the probabilities of our five individual attack outcomes: pWin2, pWin1Lose1, pLose2, pWin1 and pLose1. If our opponent has run out of armies, then the attacker has won. If the attacker has only one army, he has lost (since he must have more armies than dice), so our win probability is zero. We just need to terminate this recursion with the end-of-battle rules. Once prevents us working those values out repeatedly. This sets up a recursive definition that defines all our battle probabilities in terms of the probabilities of subsequent stages of the battle. We also have to cover the case that either side has run low on armies and there is only one game piece at stake. The probability of winning the battle is therefore the sum of the probabilities of winning after the killed armies are removed multiplied by the probability of that outcome. The attacker wins twice or loses twice, or both sides lose one army. There are three possible outcomes for a single round of the battle. The main case is when both sides have enough armies to fight with at least two dice. So my goal is to create a function pBattle that returns the probability that the battle ends ultimately as a win for the attacker, given that the attacker started with a armies and the defender started with d armies. This process is repeated until one side runs out of armies. The highest die kills an army and, in the event of a draw, the attacker is the loser. Both players throw simultaneously and then the highest die from each side is paired, and (if both threw at least two dice) the next highest are paired. To have the best chances of winning, you always use the most dice possible, so I will ignore the other cases. Here are the basic battle rules: the attacker can choose up to three dice (but must have at least one more army than dice), and the defender can choose up to two (but must have at least two armies to use two). The Wolfram Language makes it so easy to work out the exact values that I couldn’t resist calculating them once and for all. However, all the ones that I have seen do this by Monte Carlo simulation, and so are innately approximate. There are lots of places on the web where you can find out the odds of winning a battle given the number of armies that each player has. The classic board game Risk involves conquering the world by winning battles that are played out using dice.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |