Question: In this program, you will import data O X X X X X X X X X X X X X X X X X

In this program, you will import data
O X X X X X X X X X X X X X X X X X X X
O O O O X X X X O X X X X X X X X X X X
O X X O X X X X O O O O O O O O O O X X
O X O O O X X X O X X X X X X X X O X X
O X O X O X X X O O O X X X X X X O X X
O X O X O X X X X X X O O O O O O X X X
O X O O O O O O O O O X X X X X X X X X
O X O X X X O X X X X X X X X X X X X X
O O O X X X O X X X X X X X X X X X X X
X X X X O O O O X X X X X X X X X X X X
X X X X O X X O X X X X X X X X X X X X
X X X X O X X O X X X X X X X X X X X X
X X X X O X X O X X X X X X X X X X X X
X X X X O X X O O O O O X X X X X X X X
X X X X X X X X X X X O X X X X X X X X
X X X X X X X X X X X O O X X X X X X X
X X X X X X X X X X X X O O X X X X X X
X X X X X X X X X X X X X O O O O O O X
X X X X X X X X X X X X X X X X X X O X
X X X X X X X X X X X X X X X X X X O O
a 20 by 20 array. The data type you use for your 2-D array is of your choice but the X's in the file represent where you can not go and the O's represent where you can go. So for example, you can use 0s and 1s for this array if you want to.
Imagine you have a coordinate that represents you as the player. You will start off by printing a story of how you need to get to index [19][19] and you are starting at index [0][0].
The pathway to get from [0][0] must be stored in a stack. The program has to use the stack to store where it has been when it is trying out pathways. You will use push and pop operations. Push operations to keep track of where you have been, and pop operations to backtrack if you reach a dead end. You may also find using the peek operation to be useful as well.
When you have reached the end, [19][19], you will print out the pathway by popping the stack to another stack, then popping the stack in the proper order to show the pathway from beginning to end.
Once the player has solved the maze by reaching index [19][19], you should print out a message saying "Congratulations! You reached the end!". Then, you need to also print out every coordinate visited on the pathway the player took.

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 Programming Questions!