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

THIS IS ONE DOCUMENT. COMPLETE THE ASSIGNMENT USING X-SESSION PROGRAM Overview I

ID: 3873749 • Letter: T

Question

THIS IS ONE DOCUMENT. COMPLETE THE ASSIGNMENT USING X-SESSION PROGRAM

Overview In this homework you will describe an algorithm in pseudo-code to make a robot successfully navigate a maze. The purpose of this assignment is simply to get your algorithmic juices flowing and to prepare you for the kind of procedural thinking that wil be necessary both to succeed in this course and in general as a programmer Submission Instructions This and all other assignments will be submitted through BBLcarn. Look for the submission link in the same place you found this assignment Technical Description and Instructions Consider a maze like the one below. The 'S' represents where you start and the E' is the end goal. The dotted line represents the only path from start to finish (with no backtracking): Finding the dotted path through the maze would not be hard with a bird's eye view of the maze like we have in this document. This is a huge advantage. Imagine now that a person was tasked with finding their way through a real maze with walls much taller than they could see over. How might they find the way ou

Explanation / Answer

Pseudocode:

1) Start at the start position(S)

LOOP:

2) Continue moving forward along the path until you hit a wall.

3) At any such point make sure that the path you take ensures that the maze wall is to your right(If you turn right you encounter the wall)

Continue along the LOOP till you hit the End position (E).

--------------------------------------------------------------------------------------------------------------------------------------------------------

Robot algorithm:

----------------------

Available functions:

- is_facing_wall()

- turn_clockwise()

- move_forward()

- is_at_destination()

- turn_counterclockwise(){

turn_clockwise()

turn_clockwise()

turn_clockwise()

}

- check_wall_at_right(){

turn_clockwise()

if(is_facing_wall()){

turn_counter_clockwise();

return true;

}

else{

   turn_counter_clockwise();

return false;

}

}

Maze traversal:-

---------------------

while(true){

if(is_at_destination())break;

if(!is_facing_wall())move_forward();

else{

turn_clockwise();

if(!check_wall_at_right){

turn_counter_clockwise();

turn_counter_clockwise();

}

}

}

-------------------------------------------------------------------------------------------------------------------------------------------------------

If the robot reaches back to the start location during maze traversal that implies that there is a loop in the maze in which case the above mechanism may not work for maze solution and instead path marking during traversal will need to be resorted to (Tremaux's algorithm).