Create a simulation of the classic board game

Assignment Help Other Subject
Reference no: EM131151126

This is a partial monopoly simulation only tracks how many times the player landed on each positions.

I want you to create a simulation of the classic board game, Monopoly.

You will not be simulating the entire game. You will be simulating only the movement of pieces, and will keep track of which squares the pieces land on.

If you have never played Monopoly before, I recommend watching a few videos on the topic.

https://www.youtube.com/watch?v=4Hfe97Q5kul

(https://www.youtube.com/watch?v=4Hfe97Q5kul)

Rules for movement

The Monopoly Board is effectively a circle with 40 spaces on which a player can land. Players move from space to space around the board in a circle (square).

The number of spaces a player moves is determined by the roll of 2 dice. Most often, the player will roll the dice, land on a space, and end his turn there.

There are, however, several exceptions which provide the primary source of variation in space landing:

One space sends players directly to jail. This space never counts as having been "landed upon." As soon as the player lands here, he is immediately sent to jail, and the jail space gets counted as landed upon. This is the only space on the game board that moves a player's piece.

If a player rolls doubles (two of the same number), the player moves his piece, and then gets to roll the dice again for another move. However, if a player rolls doubles three times in a row, he is sent directly to jail. (The third space that the player would have 'landed on' does not count, but the jail space gets counted as landed on.)

Card Decks
A player can land on a "Chance" or "Community Chest" space. When a player lands on these spaces, he draws a card from the respective deck and follows its instructions. The instructions will sometimes give money to or take money from the player with no change in the player's position on the board. Other times, the card will instruct the player to move to another space on the board. The list of cards that can be drawn from each deck is provided below.
There are nine cards in the Chance deck that move the player's token. There are two cards in the Community Chest deck that move the player's token. All other cards do not move the player's token.
A card may say 'move to the nearest railroad' or 'move to the nearest utility' or even 'go to property xxx'. In these cases, the player always moves forward. So if a player is on 'Oriental Avenue,' the nearest railroad is `Pennsylvania Railroad' and NOT 'Reading Railroad.'


The Chance and Community Chest spaces always get counted as "landed on" even if the card drawn moves the player to another space or sends him to jail. In those cases, a tally is counted for the Chance/Community Chest space, the token is moved, and then a tally is counted for the space where the player ends his turn.
Jail
Jail is the most complicated aspect of this simulation.
If a player lands on space 11 (Jail), he is not in Jail. He is 'just visiting.' His play continues on as normal.
A player can be placed in jail in several ways: he can roll doubles three times in a row. He can land on the "go to jail space." He can draw a card that sends hims to jail.
When in jail, the player has the option to pay a fee to 'get out,' or he can choose not to pay the fee. If he pays the fee, he is out of jail, and his play continues normally as before.
If he chooses not to pay the fee, he rolls the dice. If he rolls doubles on the dice, he gets out of jail and move the number of spaces the dice show. However, despite rolling doubles, he does not roll again. He takes his move out of jail and his turn ends. If he does not roll doubles, he stays in jail.
A player cannot stay in jail for more than three turns. On his third turn in jail, he rolls the dice and moves the number of spaces the dice show no matter what. If they are doubles, he moves those spaces for free. If he does not roll doubles, he moves those spaces, but must also pay a fee.


Your Simulation
Your task is to run 2,000 simulations of a game for one player that rolls the dice 100 times. This is a total of 4 hundred thousand dice rolls - 2000 games x 100 rolls x 2 dice.
Your task is to keep track of where the player lands. Advance the tokens around the board according to the rules. Keep in mind the special situations involving the cards, jail, and rolling doubles.
For your convenience, I have created the necessary data frames for the game board, and the two decks of cards.

2016f7/29 Homework
gameboard <- data.frame(space = 1:40, title = c("Go" , "Mediterranean Avenue" , "Community Ches t" , "Baltic Avenue" , "Income Tax" , "Reading Railroad" , "Oriental Avenue" , "Chance" , "Vermo nt Avenue" , "Connecticut Avenue" , "Jail" , "St. Charles Place" , "Electric Company" , "States Avenue" , "Virginia Avenue" , "Pennsylvania Railroad" , "St. James Place" , "Community Chest" , "Tennessee Avenue" , "New York Avenue" , "Free Parking" , "Kentucky Avenue" , "Chance" , "India na Avenue" , "Illinois Avenue" , "B & 0 Railroad" , "Atlantic Avenue" , "Ventnor Avenue" , "Wate r Works" , "Marvin Gardens" , "Go to jail" , "Pacific Avenue" , "North Carolina Avenue" , "Commu nity Chest" , "Pennsylvania Avenue" , "Short Line Railroad" , "Chance" , "Park Place" , "Luxury Tax" , "Boardwalk"))
chancedeck <- data.frame(index = 1:15, card = c("Advance to Go" , "Advance to Illinois Ave." , "Advance to St. Charles Place" , "Advance token to nearest Utility" , "Advance token to the near est Railroad" , "Take a ride on the Reading Railroad" , "Take a walk on the Boardwalk" , "Go to
Jail" , "Go Back 3 Spaces" , "Bank pays you dividend of $50" , "Get out of Jail Free" , "Make g eneral repairs on all your property" , "Pay poor tax of $15" , "You have been elected Chairman o f the Board" , "Your building loan matures"))
communitydeck <- data.frame(index = 1:16, card = c("Advance to Go" , "Go to Jail" , "Bank error in your favor ??? Collect $200" , "Doctor's fees Pay $50" , "From sale of stock you get $45" , "Get Out of Jail Free" , "Grand Opera Night Opening" , "Xmas Fund matures" , "Income tax refund" , "Life insurance matures ??? Collect $100" , "Pay hospital fees of $100" , "Pay school tax of $150" , "Receive for services $25" , "You are assessed for street repairs" , "You have won seco nd prize in a beauty contest" , "You inherit $100"))
You can 'hard code' the functions that handle the decks. In other words, you can write something along the lines of
## for chance deck
if(carddrawn == 1)
code changes player position to space 1 # advance to go
if(carddrawn == 2)
code changes player position to space 25 # advance to Illinois avenue
# etc.
• • •
To get you started, here is a simple function to roll two dice.
## for your convenience. feeL free to modify if you wish. dice <- function(){
faces <- sample(1:6, 2, replace=TRUE)
if(faces[1] == faces[2]) doubles = TRUE
else doubles = FALSE
movement = sum(faces)
return(list(faces=faces, doubles=doubles, movement=movement))

Your final output should be a list of the spaces on the board and how many times the space was landed upon. Arrange the table in descending order of frequency of landing.

You do not have to simulate or track money at all in this simulation.
2016f7/29 Homework

Tips

At first blush, the task may seem overwhelming.

Break the task into smaller manageable parts.

Start with a simulation that moves pieces around the board and keeps track of where they land. Then add complexity one part at a time.

Add something so landing on "Go to jail" sends the player to jail.

Add functions for the Chance and Community Chest decks. Keep in mind that some cards have no effect on player movement, while other cards do.

Add something to allow players to move again after doubles.

Finally implement the Jail. You'll need to keep track of whether the player is actually in jail or not, how many turns the player has been in jail, and the rules for getting out.

Because of the random nature of sampling, I do not expect everyone's results to match perfectly, but some overall trends should appear.

If you are unable to implement all parts of the solution, that is also okay. I cannot give you full credit, but please indicate what you were able to implement and what you were not able to implement. You will be graded on what you were able to complete.

It may or may not be to your advantage to create a reference class for the player, keeping track of the player's position, whether he's in jail, what turn it is in jail, and anything else.

If the player rolls the dice, then he moves to the chance position. He gets a chance card to move again. We should both count the chance position and the second position.

Reference no: EM131151126

Questions Cloud

What are the major elements of strategic planning : What are the major elements of strategic planning? Refer to HBS case reprint, Southwest Airlines: In a Different World. What elements of strategic planning are present in the case study
Major benefits and potential barriers to achieving benefits : What are the major benefits and potential barriers to achieving benefits in an EHR? What steps are important to overcome barriers? Described the three forms of signatures in the EHR and explain how they differ. Also provide examples on how they might..
Determine v0 in the op amp circuit : Determine V0 in the op amp circuit shown:
Develop three period weighted moving average forecast : Consider the following data: time: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 price: 56, 92, 93, 96, 107, 122, 135, 137, 144, 158. For this data, develop a 3-period weighted moving average forecast (you choose the weights) and an exponential smoothing forecast (y..
Create a simulation of the classic board game : How many times the player landed on each positions - create a simulation of the classic board game, Monopoly
How much will you have in your account on first october : Suppose that on January 1 you deposit $100 in an account that pays a nominal interest rate of 11.33463%, with interest added daily. How much will you have in your account on October 1, or 9 months later?
Typically expect to collect unemployment insurance : Workers can typically expect to collect unemployment insurance for 26 weeks under the condition that
Create value or improve your services : How might a "Patient Relationship Management System" create value or improve your services or the bottom line. If you do not work in Healthcare, relate the principles to your own organization
Decisions are important in the product planning process : Apply the theory of benefits to the computers MJA, Inc. wish to sell. What benefits are consumers really getting from purchasing one of MJA, Inc. PC’s? What particular product decisions are important in the product planning process?

Reviews

Write a Review

Other Subject Questions & Answers

  Determine conflict resolution and conflict style

Discuss a time when the climate of a situation clearly had a negative or positive impact on conflict in which you were involved. Describe the conflict situation and the climate in sufficient detail.

  Different types of serial offenders and mass murderers

You have read about a number of different types of serial offenders and mass murderers in this section. Unfortunately, there are too many for the book to adequately cover not to mention even more after this portion of the book was published.

  Give suggestion to students regarding career

A fellow student says, "So, I am not good writer. But I have other places to put my study time. I am management major. Provide this student your best suggestion, as well as the reasoning behind it.

  Define competencies required to support your career goals

Define the competencies required to support your career goals. Analyze your career goals. Conduct an analysis of your current competencies and report on your findings.

  Explain the process you would use to make this decision

You are a division manager at Austen Pharmaceuticals and supervise 50 average or above-average employees. Many have been with the organization for several years. Several recent hires, women and minorities, were hired to increase diversity in the ..

  Meaning of cultural empathy

Explain what "cultural empathy" means to you? Can we really know the inner experiences of clients? How has this course prepared you to deal with cultural diversity in your chosen area of counselling practice?

  What leadership style should bjorn use

Swedish Attorney, Bjorn Liar has been asked to lead a group that will decide which of his firm's associates will be offered partner status. He's been asked to be more expressive and to include everyone in the decision-making process. What leadersh..

  How many medals were awarded all together

In a sports contest there were m medals awarded on n successive days (n > 1). On the first day 1 medal and 1/7 of the remaining m - 1 medals were awarded. On the second day 2 medals and 1/7 of the now remaining medals was awarded; and so on.

  The famous person in your aticle appears on a chat

write a feature article about a famous person explaining why you have such strong view about this person. 700 wordsthe

  Experiment involving an experimental group-control group

Lay out the design for two between-subjects experiments: (a) an experiment involving an experimental group and a control group, and (b) a factorial design with three independent variables that have 3, 2, and 2 levels, respectively.

  Examples of a sample and a population

What are real-world examples of a sample and a population? Compare and contrast probability sampling with non-probability sampling, providing an example of each.

  What are the goals or objectives you are focused

What are the goals or objectives you are focused on at this time in your career and why? How will you ensure you reach your goals? Justify your response with examples.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd