- All Contests
- ProjectEuler+
- Project Euler #84: Monopoly odds

# Project Euler #84: Monopoly odds

# Project Euler #84: Monopoly odds

_{This problem is a programming version of Problem 84 from projecteuler.net}

In the game, , the standard board is set up in the following way:

A player starts on the *GO* square and adds the scores on two dice to determine the number of squares they advance in a clockwise direction. Without any further rules we would expect to visit each square with equal probability: . However, landing on *G2J* (Go To Jail), *CC* (community chest), and *CH* (chance) changes this distribution.

*G2J* and one card from each of *CC* and *CH* order the player to go directly to jail.

At the beginning of the game, the *CC* and *CH* cards are shuffled. When a player lands on *CC* or *CH* they take a card from the top of the respective pile and, after following the instructions, it is returned to the bottom of the pile. There are sixteen cards in each pile, but for the purpose of this problem we are only concerned with cards that order a movement; any instruction not concerned with movement will be ignored and the player will remain on the *CC/CH* square.

- Community Chest (2/16 cards):
- Advance to GO
- Go to JAIL

- Chance (10/16 cards):
- Advance to GO
- Go to JAIL
- Go to C1
- Go to E3
- Go to H2
- Go to R1
- Go to next R (railway company)
- Go to next R
- Go to next U (utility company)
- Go back 3 squares.

The heart of this problem concerns the likelihood of visiting a particular square. That is, the probability of finishing at that square after a roll. For this reason it should be clear that, with the exception of *G2J* for which the probability of finishing on it is *zero*, the *CH* squares will have the lowest probabilities, as *5/8* request a movement to another square, and it is the final square that the player finishes at on each roll that we are interested in. We shall make no distinction between "Just Visiting" and being sent to JAIL, and we shall also ignore the rule about requiring a double to "get out of jail", assuming that they pay to get out on their next turn.

Statistically it can be shown that the three most popular squares, in order, are JAIL (5.90%), E3 (3.19%) and GO (3.11%).

If, instead of using two dice, two dice are used, find the most popular squares in order.

**Input Format**

**Sample Input**

```
6 3
```

**Sample Output**

```
JAIL E3 GO
```