Question: DCODE IN C + + ! ! ! ! RECURSAL MAZE Do not solve this project with recursion. Instead, follow the right - hand rule
DCODE IN CRECURSAL MAZE Do not solve this project with recursion. Instead, follow the righthand rule as described in the text and below.
Do not interactively enter the maze. There are 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 "mazelayouth
Program a rat your maze runner to have a direction: up right, down, and left can be coded as its forward direction. Based on which of the four directions, it should then try to go right relative to its forward direction. Eg 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 matrixmaze at each step. Stop when the rat finds the exit.
mazelayouth :
Establish fixed maze # is a wall, is a path
char maze
############
###
#######
######
#####
########
######
#######
###
##########
###
############
;
set starting and ending points
int startRow ;
int startCol ;
int endRow ;
int endCol ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
