Project Euler Problem 084

# Statement

The statement of this problem is too long to put it here. This is the link to the original problem.

But basically you have to find the three squares in Monopoly that have more probabilities of being occupied, but instead of 2 dices with 6 faces with 2 dices of 4 faces.

# Solution

Simulate a player for 1000000 rolls of dices and see the results.

```import random

board = [0 for x in range(40)]
cc = 0
ch = 0
doubles = 0
position = 0
rw = (5, 15, 25, 35)
ut = (12, 28)

def make_move():
global board, cc, ch, doubles, position, rw, ut
dice1 = random.randint(1, 4)
dice2 = random.randint(1, 4)
if dice1 == dice2:
doubles += 1
else:
doubles = 0
if doubles == 3:
position = 10
doubles = 0
return
position += dice1 + dice2
position %= 40
if position == 30:
position = 10
return
elif position == 2 or position == 17 or position == 33:
cc = (cc + 1) % 15
if cc == 0:
position = 0
return
elif cc == 1:
position = 10
return
elif position == 7 or position == 22 or position == 36:
ch = (ch + 1) % 15
if ch == 0:
position = 0
return
elif ch == 1:
position = 10
return
elif ch == 2:
position = 11
return
elif ch == 3:
position = 24
return
elif ch == 4:
position = 39
return
elif ch == 5:
position = 5
return
elif ch == 6 or ch == 7:
while position not in rw:
position += 1
if position == 40:
position = 0
return
elif ch == 8:
while position not in ut:
position += 1
if position == 40:
position = 0
return
elif ch == 9:
position -= 3
return

if __name__ == '__main__':
result = ""
for i in range(10 ** 6):
make_move()
board[position] += 1
max_prob = sorted((-board[i], i) for i in range(len(board)))
result = "%2d%2d%2d" % (max_prob[0][1], max_prob[1][1], max_prob[2][1])
print("The result is:", result)
```