In: Computer Science
Write a pseudo code program for a goal-based agent. The goal of the agent is to find the exit of a labyrinth.
The maze is constructed of paths that are 1 unit across (wide)
Show a maze of your choosing and illustrate the path taken from start to exit according to your program (example shown here).
PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE, IF YOU NEED ANY MODIFICATION THEN LET ME KNOW, I WILL DO IT FOR YOU
1. What we will do is go to every way where we can, and in this cycle of setting off to all ways, in the event that we experience last objective directions we will return 1 .
2. Else we will restore 0 on the off chance that we have not discovered any way or we have arrived at an impasse state a divider we will backpedal on the way we have come and attempt another chance.
3. At every crossing point, we have 3 prospects, to go straight or to take left or go right.
/we are putting away an extra 2d cluster path_till_now as should be obvious in work definition func(path_till_now). So this exhibit will contain the way we have continued as far as the x and y organizes the robot followed till now.
func(path_till_now)
{
if(exit found)
stop and print leave found
if(can push ahead)
push 1 stride ahead
else
backpedal on same way we have taken
if(can move left)
move left 1 unit to the bearing u are confronting
else
backpedal on a similar way we have come till now
if(can move right)
move right 1 unit to the course u are confronting
else
backpedal on a similar way we have come till now
}
4. Anytime in the event that we arrive at an impasse state divider we backpedal on the way we have followed to the latest choice. let's assume we took 1 chance say going straight and now we have arrived at a divider after this progression, we backpedal on a similar way for example we go the retrogressive way and now attempt the second chance that is going the left way.
5. In the event that we get another divider after this progression, at that point we again return to our past position and will presently attempt our third chance for example going right.
6. In any of the ways on the off chance that we arrive at our objective, we stop and state we discovered our exit.