Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE WRITE IN C++ A creature, indicated in the previous diagram by o, sits jus

ID: 3699059 • Letter: P

Question

PLEASE WRITE IN C++

A creature, indicated in the previous diagram by o, sits just inside the maze at the entrance (bottom row). Assume that the creature can move in only four directions: north, south, east, and west. In the diagram, north is up, south is down, east is to the right, and west is to the left. The problem is to move the creature through the maze from the entrance to the exit (top row), if possible. As the creature moves, it should mark its path. At the end of the trip through the maze, you should see both the correct path and incorrect attempts. Write a program to solve this problem.

Design:

Code:

Output:

Explanation / Answer

Answer:

toNorth(maze, o_creature, success)

if( Inside the maze, the concerned square towards the north is open and unvisited)

{move to the north and allocate the marked square to the current path}

if(at exit)

success==true

else

{toNorth(maze, o_creature, success)

if (!success)

{goWest(maze, o_creature, success)

if (!success)

{goEast(maze, o_creature, success)

if (!success){the square is marked visited

executes backtrack South;

}

}

}

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote