Fundamentals of Computer Science I

Scientific Assignment 6

Use Python for Game Theory Calculations.

Monopoly is a very competitive game played by people across the entire world. While there is a lot of luck involved in Monopoly, there is also a fair bit of strategy involved as well. Which real estate should you buy? The more real estate you own, the better. However that also costs a lot of money. The more strategic is to buy the locations that are most commonly landed on during the course of a Monopoly game. For this assignment, you will determine what spaces have the highest probability of being landed on.


You are going to represent a Monopoly board as a list of 40 integers. These integers are going to represent the count of the number of times an arbitrary player lands on a particular space. You are going to estimate this probability using the monte carlo method. You are going to start with a player at Go! (array index 0). You will generate 2 random numbers in the range \([1, 6]\) (You cannot generate a random number in the range \([1, 12]\), since this will not create the same distribution as a dice roll of two dice). This will move the player to a new location on the board, and you will increment the value in that space. You will then perform this again, with the player at the new location.

If the player lands on Go to Jail, you should send them directly to Jail.

There are a lot of other more obscure rules. We are not going to worry about these rules (Such as rolling doubles 3 times in a row, etc.). The rules listed above are the only rules you need to worry about.

You should run this process until the player has made 1,000 trips around the entire board. After the player has made the required number of trips around the board, you will output a list of all the probabilities for each of the locations on the board. The output should be nicely formatted so that you can use the image above to determine the board locations that have the highest probabiliby to be landed on during a single trip around the board.

"Hacker" Prompt

Each week, additional exercises related to the assignment will be provided at the end. These exercises are typically more challenging than the regular assignment. Bonus points will be provided to students who complete any of the "Hacker" level assignments.

  1. Doubles: In the real game of Monopoly, if you roll doubles 3 times in a row you go directly to jail. Modify your code above so that if a double is rolled 3 times in a row the user is sent directly to jail.

  2. Chance and Community Chest: While you will get decent results from above, you can do better if you handle the Community Chest (2, 17, 33) and Chance (36, 22, 7) locations. These locations have a certain probability to send you to another location on the board. For the Community Chest, there is a \(\frac{1}{16}\) chance of being sent to jail. For Chance, the distribution is a bit more complex:

    Sent to Go! (00)
    Sent to Reading Railroad (05)
    Sent to the closest Railroad (05, 15, 25, 35)
    Sent to Jail (10)
    Sent to the closest Utility (12, 18)
    Sent to St. Charles Place (11)
    Sent to Illinois Ave. (24)
    Sent to Boardwalk (39)
    Sent back 3 spaces

    Alter the code to follow the above probabilities when you land on the appropriate squares.

  3. User Friendly Printing: The printout that you provided above was not very user friendly. It didn't even write out the names of the squares! Add code to your program so it outputs the name of the square, and its associated probability.


Your code should conform to the course’s code conventions and will be graded according the the course’s programming assignment rubric. Submit your program as a .py file on the course Inquire page before class on Friday November 7th.