Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone help me with this C++ problem please? Coding chutes n ladders in c++ (text file it talks about in instructions) (example of output
Can someone help me with this C++ problem please? Coding chutes n ladders in c++
(text file it talks about in instructions)
(example of output - goes on for longer but cut off the image for space)
. . How the game works: 10 players start at zero and try to move up the board to 100. Each turn, a player rolls one die and moves up that many squares (1...6). Along the way are 19 squares that either allow the player to climb a ladder to a higher number, or make the player slide down a chute to a lower number. If a player lands on a chute or a ladder, they must move up or down accordingly. Each chute and ladder has a descriptive picture of what the player did to deserve to climb or slide. We will use text to describe what happened. The first player that lands on square 100 with an exact roll wins. If a player rolls and gets a number that would move them over 100, they do not move. One ladder (on square 80) takes the player to square 100, winning the game. . Special squares (chute and ladder squares): Here is a list of the 19 chute and ladder squares along with descriptions and destination squares: Square landed on: What player did Square traveled to: 1 You potted a plant! 38 5 You made a cake! 14 9 You mowed the yard! 31 15 You skipped homework! 6 21 You helped a puppy! 42 28 You rescued a cat! 84 36 44 47 26 49 11 51 You ate healthy food! You skated on thin ice! You ate too much candy! You swept the floor! You stayed out in the rain! You dropped dishes! You rode a bike no-handed! 68 56 53 62 19 64 60 71 You returned a dropped purse! 91 80 100 You held a pet show! You stole from cookie jar! 87 24 93 You drew on the wall! 73 95 You broke window! 75 98 You pulled cat's tail! 78 Input file: The data for these squares is stored in a file called chutesnLadders.txt". Each line in the file contains the data for one special square. The lines are formatted as follows: int int string. Where the first integer is the location of the special square, the second integer is the square that the player is moved to when they land on the special square, and the string is a description of what the player did to deserve the bonus/penalty associated with the square. An example line might look like this: 413 You fed the dog! In this case, a player landing on square 4 would be moved to square 13 and the description of their action is You fed the dog!" You must connect an input file stream to the "chutesnLadders.txt" file to read the data for the special squares. What to display: Before every turn, including the first turn, and also when the game is over, show a list of the players and what square they are on. Also, when the game is over, congratulate the winner. Example output: There are three text files, Chutes&LaddersRun1.txt, Chutes&LaddersRun2.txt and Chutes&LaddersRun3.txt. Each one contains the output of one running of the program. Your program does not have to look exactly like the example but should be close and easy to follow. What to turn in: Any.cpp and/or .h files you create to complete the program. Remember, do NOT submit.sin files. HINT: How to get a die roll: 1) #includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started