Robot Maze Reference

robot methods

NameArgumentsReturns
getRunsNoneint - Number of previous runs the robot has made of the current maze
look int - Direction in which to lookint - State of the maze square in the given direction
faceint - Direction in which to face the robotvoid
setHeading int - Heading in which to face the robotvoid
getHeading Noneint - Current heading of the robot
getLocation NonePoint - The x and y coordinates of the robot in the maze
getTargetLocationNonePoint - The x and y coordinates of the robot's target

Headings

NORTH, EAST, SOUTH and WEST are referred to as headings.
Headings are used for setHeading and returned by getHeading.

NameValue
NORTH1000
EAST1001
SOUTH1002
WEST1003

Directions

AHEAD, RIGHT, BEHIND and LEFT are referred to as directions. Directions are relative to the robot's current heading. Directions are used for look and face. CENTRE can be used as a null value.

NameValue
AHEAD2000
RIGHT2001
BEHIND2002
LEFT2003
CENTRE2004

States

WALL, PASSAGE and BEENBEFORE are referred to as states that a square in the maze can have. They are returned by look. PASSAGE means an empty square that has not been visited yet, BEENBEFORE is an empty square that has been visited.

NameValue
WALL3000
PASSAGE3001
BEENBEFORE4000

Coordinates

Maze coordinates start in the top left corner with $(1,1)$ and finish in the bottom right corner. The default maze is $15 \times 15$, so the bottom right corner is $(15,15)$. The coordinates of the robot are given by getLocation. The coordinates of the target are given by getTargetLocation. Both of these return a Point object (java.awt.Point), where the x coordinate is given by p.x and the y by p.y where p is the Point object.

Important notes

Only headings can be used as the argument for setHeading. Only directions can be used as the argument for look and face.
IRobot is an interface, robot is an instance of an implementation of IRobot.