Answered step by step
Verified Expert Solution
Link Copied!

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++

image text in transcribedimage text in transcribedimage text in transcribed

(text file it talks about in instructions)

image text in transcribed

(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) #include 2) Put "srand((unsigned)time(NULL));" at the top of the main() function 3) When you want a number between 1 and 6 use this: "(rand() % 6) + 1" 38 14 31 6 42 1 5 5 9 15 21 28 36 47 49 51 56 62 64 71 80 87 93 95 98 84 44 26 11 68 53 19 60 91 100 24 73 75 78 You potted a plant! You made a cake! You mowed the yard! You skipped homework! You helped a puppy! You rescued a cat! 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! You returned a dropped purse! You held a pet show! You stole from cookie jar! You drew on the wall! You broke window ! You pulled cat's tail! Welcome to Chutes and Ladders!! 0 0 ************************* Current Standings: Player: Square: 1 0 2 0 3 4 5 6 7 8 9 10 0 0 0 0 0 0 0 ************************* 9 0 0 Player 1, take your turn. You rolled a 6 You landed on 6. You are on square 6 ************************* Current Standings: Player: Square: 1 2 0 3 4 0 5 0 7 8 9 0 10 ************************* Player 2, take your turn. You rolled a 4 You landed on 4. You are on square 4 ************************* Current Standings: Player: Square: 9 0 0 0 9 0 9 2 4 3 4 0 5 0 0 7 8 9 0 10 0 ************************* Player 3, take your turn. You rolled a 3 0 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

Identify components of organizations.

Answered: 1 week ago