Position

Position

new Position()

Sets the default values for a position:

  • Coordinates are 0,0
  • Orientation is North (N)
  • Lost is false
Source:

Methods

isOffTheGrid(grid) → {boolean}

Check if robot is off the grid. If it's, sets lost to true

Source:
Parameters:
Name Type Description
grid Grid
Returns:
Type:
boolean

Returns true if the robot is off the grid

toString() → {string}

Returns the position (X Y Orientation) as string in one line. If lost is true, includes 'LOST' text.

Source:
Returns:
Type:
string