This is a pair assignment. You should create a directory called assignment 6 in cs120/assignments for this assignment. All code written for this assignment should be stored in that directory.
$ cd ~/cs120/assignments $ mkdir assignment6 $ cd assignment6
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 better strategy is to buy the locations that are most commonly landed on during the course of a Monopoly game. For this assignment, you will determine which 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.
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.
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.
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:
Alter the code to follow the above probabilities when you land on the appropriate squares.
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.
The assignment will be graded on the following requirements according to the course’s programming assignment rubric.
Functionality (75%): A functional program will:
Style (25%): A program with good style will:
Space Invaders is an early shooting game that was so popular that the pixelated images of the alien invaders have become symbols of 80's nostalgia and retro gaming. In Space Invaders you control a mobile cannon that can shoot aliens that are invading Earth.
Create a simplified version of the game Space Invaders like the following:
Make the game more like the original. Add multiple types of enemies with different behaviors like moving and shooting.
The assignment will be graded on the following requirements according to the course’s programming assignment rubric.
Functionality (75%): A functional program will:
Style (25%): A program with good style will:
Your program should include the traditional header, use appropriate variable names, and nicely label all values printed to the terminal. Submission are to be done through inquire.roanoke.edu through the Assignment 6 link. Both partners must submit through inquire!