Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Language in C++ Write a program to reach the end point in a maze using following coordinates. The coordinates of the 25 cells in a

Language in C++

image text in transcribed

Write a program to reach the end point in a maze using following coordinates. The coordinates of the 25 cells in a maze 00 01 02 03 04 10 11 12 13 14 20 21 22 23 24 30 32 33 34 40 41 42 31 44 Part (a): Please implement the game according to the following requirements: We can present the coordinates of each cell using (x, y) with x and y two values, where x and y are for the row and column index values, respectively. The program always starts from the cell (0,0) and visits different cells to reach the end point ('x'). We draw an 'o' (letter 'o' not number zero) for each cell that has been visited. We assume that the end point (X) is NOT in the first row and is also NOT in the first column. There is one and only one obstacle (**), which is NOT at the cell (0,0) and NOT at the end point. We assume that the obstacle is NOT in the first row and is also NOT in the first column. Start from (0,0) and move one step each time based on user's input (i.e. up, down, left, right or hint). When the input is one of up, down, left, or right (hint is handled in part b), o if this input leads to an empty cell (-), move to this cell and draw a footprint ('o') in this cell. o if this input leads to a position 1) outside the maze, 2) that has been visited before, or 3) with the obstacle, output an error message and then let the player to input again. If this input leads to the end point, the game is finished with a "Successfull" message. Note 1: We assume the user's input is valid. No need to check the input's correctness. Note 2: You do not need to consider the case that there is no cell to move but the game is not ended yet. Example-1: Example-2: Initial maze: Initial maze: . - - Input an integer (1 :up 2:down 3:left 4:right 5:hint): 4 OLE XIII 01 O* 15 Input an integer (1:up 2:down 3:left 4:right 5:hint): 4 * Input an integer (1 :up 2:down 3:left 4:right 5:hint): 4 Input an integer (1:up 2:down 3:left 4:right 5:hint): 2 There is an obstacle! Input an integer (1:up 2:down 3:left 4:right 5:hint): 4 10 Input an integer (1:up 2:down 3:left 4:right S:hint): 1 Outside the maze! Input an integer (1 :up 2:down 3:left 4:right 5:hint): 3 You have visited this cell before! Input an integer (1:up 2:down 3:left 4:right 5:hint): 2 Input an integer (1 :up 2:down 3:left 4:right S:hint): 2 O SOO OIIII 1 1 1 Successful! Successful

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

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions

Question

Does it highlight your accomplishments rather than your duties?

Answered: 1 week ago

Question

Working with other project stakeholders for support.

Answered: 1 week ago