Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a file chutes.cpp. Write a function int move(int board[], int at, int roll) to compute the final position for a move on a Chutes

Create a file chutes.cpp. Write a function int move(int board[], int at, int roll) to compute the final position for a move on a Chutes and Ladders (https://en.wikipedia.org/wiki/Snakes_and_Ladders#Specific_editions ). Write a driver to test the function. Here are the details:

Create an array to represent the board, either globally or in main().

The board has only 10 positions

Each element of the array indicates where the player would end up if they land on this position.

If the position is neither the start of a chute or the start of a ladder, the ending position is simply the position itself.

There are ladders from position 0 to position 7 and position 3 to position 5.

There is a chute from position 6 down to position 1.

Players start off the board

The at parameter represents where the player is starting

The roll parameter represents the value rolled by the player (1 to 6, though you dont need to check this)

If the roll would move past the end of the board, return the last position

The test cases: try to land on each of the chutes and ladders (3 cases), land on a regular position (1 case), get a roll that would send the player past the end of the board (1 case)

Store the starting positions, rolls and expected ending positions in arrays

Call move() to try each case

Summarize the results, like as follows:

Testing Chutes and Ladders moves

Passes = 5

Fails = 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

How To Make A Database In Historical Studies

Authors: Tiago Luis Gil

1st Edition

3030782409, 978-3030782405

More Books

Students also viewed these Databases questions

Question

9. Explain the relationship between identity and communication.

Answered: 1 week ago

Question

a. How do you think these stereotypes developed?

Answered: 1 week ago

Question

a. How many different groups were represented?

Answered: 1 week ago