Question
C++ Language only: For this project, you will be designing the project and writing the code from the bottom, up. You will write software to
C++ Language only:
For this project, you will be designing the project and writing the code from the bottom, up. You will write software to allow a user to traverse a given maze. More specifically, your program will ask the user for a maze file name. It will open the file to load the maze into a 2-D array. It will then wait for the user to traverse the maze using the up, down, right, left arrow keys. The file format will contain the number of rows and the number of columns in the maze, followed by (rows X columns) characters forming the maze.
There will be 4 different characters in the maze:
X: will represent a wall
(space): will represent an open path
@: will represent the beginning of the maze
!: will represent the end of the maze.
Two text files containing mazes will be provided for you. You should create additional test files. The user would like to get out of the maze with the least amount of cost. Each up, right, down, or left arrow keys the user hits, will cost money. If the user hits an open space on the path, $1 is charged and the space is changed to the @ character, and the previous location is changed to a space. If the user hits a dollar sign on the path, $20 dollars will be deducted from the total cost. If the user hits a wall, $1000 will be charged and the user will be kicked out of the maze. The cost of the maze will be printed. When the user hits the ! character, representing the end of the maze, a $1 is charged for that step and the program will print an appropriate message that they have exited the maze, along with the cost of the maze. As the user traverses the maze, the @ symbol should follow (the maze will have to be displayed after every move). Note, all mazes should have a complete, surrounding wall of Xs which should make staying in the array bounds feasible.
Sample maze txt:
12 20
XXXXXXXXXXXXXXXXXXXX
X@XX $ XXXXXXXXXXX
X$XX XXX XXXXXXXXXXX
X XX XXX XXX
X$XXXXX XXXX XXX XXX
X XXXXX XXXX XXX XXX
X XXXXX XXXX XXX XXX
X XXXXX XXXX XXX XXX
X X$ XXX XXX
X XX XXXXXXXXXXX XXX
X XXXXXXXXXXX XXX
XXXXXXXXXXXXXXXX!XXX
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started