Methods
move(instructions) β {string}
Perform all the movements. In the moment robot is lost, does nothing
- Source:
Parameters:
Name | Type | Description |
---|---|---|
instructions |
String
|
Returns:
- Type:
-
string
All the instructions
moveForwards()
Move one step forward, according to the orientation and change the position:
- Orientation (N) means
y + 1
- Orientation (S) means
y - 1
- Orientation (E) means
x + 1
- Orientation (W) means
x - 1
- Source:
setPosition(startPosition)
Given a Position (x, y, orientation), sets the robot position and orientation
- Source:
Parameters:
Name | Type | Description |
---|---|---|
startPosition |
String
|
turnLeft()
Changes the orientation of the robot 90ΒΊ left, according to the current orientation
- Source:
Example
Robot is facing North (N)
Turn Left
Now, robot is facing West (W)
turnRight()
Changes the orientation of the robot 90ΒΊ right, according to the current orientation
- Source:
Example
Robot is facing South (S)
Turn Right
Now, robot is facing West (W)