Question: C + + Please Need help with C + + code for this problem Write a program that involves a tadpole getting out of a

C++
Please Need help with C++ code for this problem
Write a program that involves a tadpole getting out of a maze of walls. The tadpole is given an initial starting position in a rectangular maze, which for the purpose of this program is depicted as an r by c matrix of cells. The tadpole can swim from one cell to a horizontally or vertically adjacent cell,
avoiding the walls, until he gets out of the maze by landing on the exit cell. However, if the tadpolemoves into a "magic" cell (a cell denoted by a single digit d), he temporarily turns into a frog. A frog has special frog powers that enable him to jump either horizontally or vertically over d number of cells
and/or walls. If, after he jumps, the frog:
lands on the exit cell, he gets out of the maze.
lands on an empty cell, he turns back into a tadpole and continues.
lands on another magic cell, he remains a frog and can jump to another cell if possible.
If the frog cannot jump to one of the above three kinds of cells, he returns to his tadpole state with no magic powers and can swim to another cell if possible. The starting cell is the first cell visited by the tadpole. A cell is considered visited when either the tadpole or frog enters it. Neither the tadpole nor the frog:
can visit or jump to a previously visited cell.
can visit or jump to a wall.
can go outside the maze.
Input will be from a data file. The first line of input will contain a single integer n in the range [1,5] that indicates the number of mazes to follow. For each maze, the first line will contain the size of the maze in the form r c where r is the number of rows and c is the number of columns in the maze
are both in the range [3,8]. The next r lines will contain c characters as follows:
'*'-is a wall.
'.'-is an empty cell to which the tadpole or frog can move.
d -is a digit in the range 1 through 4 which indicates that the tadpole has turned into a frog. d is
the number of cells (including wall cells) that the frog can jump over, if possible, before turning back into a tadpole. For example, if d =3, the frog would land on the 4 th cell fromwhere he started.
'$'-is the tadpole's starting position.
'@'-is the cell that the tadpole will use to exit the maze.
For each maze, output to screen the minimum number of cells in the maze that the tadpole will visitbefore exiting the maze. Let the user input the file name from the name from the keyboard. Finally the program should ask if the user wants to run the program again (Check case). Refer to the sample output below.
Sample File:
2
88
******..
....$...
..***.2.
.3..***.
**.2.***
***.....
....@...
****..**
57
****$**
**....2
.*..3..
.*....*
Sample run:
Enter filename: frogger.txt
Maze 1: 8 cells
Maze 2: 6 cells
Run again (Y/N): n

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!