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

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

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