- #Secrets of the lost tomb rolling more than 8 dice how to#
- #Secrets of the lost tomb rolling more than 8 dice code#
It matters because we don’t need to keep track of all the possible paths in a battle if the battle is a Markov process. Another way of saying this is that a process has the Markov property if it doesn’t remember how it got to the current state. A random process has the Markov property if the future outcomes of the process only depend on the current state of the process. This means that a Risk battle satisfies the Markov property. We may feel worse as the attacker if we started 50-on-39, but the probabilities of the 3-on-2 attack outcomes are the same either way. If the next attack is 3-on-2, it doesn’t matter if the battle started 10-on-6 or 50-on-39. The only thing that matters is the current state (i.e., how many armies each side has for the next attack). If we know the number of armies, we know the number of dice to roll at each step, so we can figure out all the probabilities at each step. The number of armies satisfies this requirement in Risk. The state space has to tell us everything we would need to compute the probabilities for the next possible value of the process. A state space is a set of values which a process can be in at any particular time. We can think of the number of armies each side has as the state of the battle at any point in time. State SpaceĬonsider the Risk battle as a random process. We also can figure out the possible outcomes of that attack, and the distribution of possible armies each side will have left after the first attack. Since we know how many armies each side has, we know how many dice will be rolled in the first attack. The basic idea is to start at the beginning of the battle. This example using Risk is meant as a simple introduction. We will use Markov chains a lot on this site to analyze sports. Markov chains are named after the important Russian mathematician Andrey Markov. The framework used to model a general battle is called a Markov chain.
#Secrets of the lost tomb rolling more than 8 dice code#
This code may be a little hard to understand, but it’s not that different from how you would solve this problem by hand if you had to. We will look at exactly how many possibilities there are for various Risk battles in a future post.įor now, I want to show you one way to solve this counting problem in Python, so you can see some useful results. Things were relatively simple for the 2-on-1 example, but for a 10-on-6 attack there are many more possibilities. The hard part about modeling battles in Risk is keeping track of all the possible ways a battle could go. If the defender loses an army, the battle is over.ĭef attacker_wins ( outcome ): """True if attacker won battle.""" return attackers ( outcome ) > 0 and defenders ( outcome ) = 0 def defender_wins ( outcome ): """True if defender won battle.""" return attackers ( outcome ) = 0 and defenders ( outcome ) > 0 Markov Chains The possible outcomes are: the attacker loses an army, or the defender loses an army. In a 2-on-1 battle, the first attack is also 2-on-1.
#Secrets of the lost tomb rolling more than 8 dice how to#
Later we’ll figure out how to automate this for any possible battle. Let’s compute “by hand” the probability that the attacker wins a 2-on-1 battle. For the defender to win the battle, either the attacker’s armies are reduced to zero (not including the one army that’s required to remain behind), or the attacker calls of the attack. Let’s look at how to do that now.įor the attacker to win a battle, the defender’s armies must be reduced to zero in the attacked territory. But, what we ultimately are about is probability of winning a battle.
It’s great to analyze the armies lost in a given attack. Those are the possible outcomes in terms of armies lost in any given Risk attack, along with the probability of that outcome happening.