Question: We're going to write a C++ program that helps you play Chutes&Ladders for a single player Specifically, the program should keep track of your position

 We're going to write a C++ program that helps you play
"Chutes&Ladders for a single player Specifically, the program should keep track of
your position in the game and should perform all the moves. The

We're going to write a C++ program that helps you play "Chutes&Ladders for a single player Specifically, the program should keep track of your position in the game and should perform all the moves. The program should not perform the die rolls instead, imagine that you roll a die yourself and enter the result on the keyboard in every round. After every die ro, you move for ward that many steps. If you land on position 7 (a ladder") you climb up to position 12. If you land on position 13 (a "chute), you fall back to position 9. The game ends when you reach position 20. This may seem like a really challenging task at first, so we're going to break it into a sequence of steps. First of all, start by thinking about the algorithm itself without worrying about the actual C++ program: How do you track a position OK, so you need a variable for that. What is a position anyway? OK, it should be an integer. How can I keep playing until I hit 20? OK, I need a while loop. When do I roll the die? OK, that part needs to be inside the while loop since it happens once every round. When should I check whether I hit a ladder? OK, after I rolled the die and moved my position forward. And so on OK, we're ready to start coding 1. Start by writing a simplified "Chutes& Ladders" program. This simplified program has no chutes or ladders, and does not track how many moves you've used (but it still stops once you've reached position 20. A sample output from this program is: Chutes and Laddersversion 1 Enter the result of the die roll: 4 Enter the result of the die roll: 3 Enter the result of the die roll: 1 Enter the result of the die roll: 6 Enter the result of the die roll: 5 Enter the result of the die roll: 3 Your position is now 4 Your position is now Your position is now 8 Your position is now 14 Your position is now 19 Your position is now 22

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!