Assignment: Algorithmic Design
Given a grid maze similar to the following:
design an algorithm and give the pseudo code to step through the maze starting at position (1, 1) and get to position (xMax -1, yMax -1). Remember to keep it generic, so don't use the example's dimensions in favor of xMax and yMax. Show that your algorithm works by tracing its steps, using the example maze for your demonstration.
‘robot' knows x,y position and facing(North, South, East, or West)
Commands given in class:
isWallInFront (abbreviated isWall) returns T if there is a wall in the next space in the facing direction, otherwise F.
atDestination returns T if x,y == position(xMax-1, yMax -1), otherwise F.
turnLeft (abbreviated TL) changes facing 90 degrees counter-clockwise.
turnRight (abbreviated TR) changes facing 90 degrees clockwise.
moveForward (abbreviated Move or Step) changes the x,y position by 1 in the facing direction.
if (condition){} If the condition is true, do what is in the brackets, no loopback.
while (condition) {} If the condition is true, do what is in the brackets and loopback.