Question: DCODE IN C + + ! ! ! ! RECURSAL MAZE Do not solve this project with recursion. Instead, follow the right - hand rule

DCODE IN C++!!!!RECURSAL MAZE Do not solve this project with recursion. Instead, follow the right-hand rule as described in the text and below.
Do not interactively enter the maze. There are 3 h files below that you can download and include into your source using an #include. Only do one at a time. Do not include all three h files in the source at the same time. An include statement example is given. Put the include where you would have declared your matrix.
#include "mazelayout1.h"
Program a rat (your maze runner) to have a direction: up, right, down, and left (can be coded 0,1,2,3), as its forward direction. Based on which of the four directions, it should then try to go right relative to its forward direction. E.g. if facing up then step right, if facing right then step down, facing down then left, etc. But in the case of facing up, if you can't go right, then try to go forward. If not, try going left, otherwise step backward (which you can always do). If you successfully take a step in that direction, change the direction for the next iteration. You may backtrack, of course, as you never become blocked. As you step forward, change the. to *; if you backtrack, then change the * to -. Of course, don't go through a wall #. Print the matrix/maze at each step. Stop when the rat finds the exit.
mazelayout1.h :
//Establish fixed maze '#' is a wall, '.' is a path
char maze[12][12]={
{'#','#','#','#','#','#','#','#','#','#','#','#'},
{'#','.','.','.','#','.','.','.','.','.','.','#'},
{'.','.','#','.','#','.','#','#','#','#','.','#'},
{'#','#','#','.','#','.','.','.','.','#','.','#'},
{'#','.','.','.','.','#','#','#','.','#','.','.'},
{'#','#','#','#','.','#','.','#','.','#','.','#'},
{'#','.','.','#','.','#','.','#','.','#','.','#'},
{'#','#','.','#','.','#','.','#','.','#','.','#'},
{'#','.','.','.','.','.','.','.','.','#','.','#'},
{'#','#','#','#','#','#','.','#','#','#','.','#'},
{'#','.','.','.','.','.','.','#','.','.','.','#'},
{'#','#','#','#','#','#','#','#','#','#','#','#'}
};
//set starting and ending points
int startRow =2;
int startCol =0;
int endRow =4;
int endCol =11;
 DCODE IN C++!!!!RECURSAL MAZE Do not solve this project with recursion.

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!