Constructor
new Mars(instructions)
Stores the instructions and accumulates robot's final instructions
- Source:
Parameters:
Name | Type | Description |
---|---|---|
instructions |
String
|
The instructions contains the grid's size and the robot's instructions |
Methods
isNewRobot(instruction) → {boolean}
If the instruction is equal to empty string, creates a new robot which is going to be used in the next for-loop iteration
- Source:
Parameters:
Name | Type | Description |
---|---|---|
instruction |
String
|
The current instruction |
Returns:
- Type:
-
boolean
isRobotStartingPosition(instruction) → {Boolean}
If the instruction includes a blank space, it means the instruction is the position where the robot should start the mission
- Source:
Parameters:
Name | Type | Description |
---|---|---|
instruction |
String
|
May be the starting position of a robot or the real instructions to follow to move |
Returns:
- Type:
-
Boolean
sendRobots() → {string}
Given some instructions, creates a Grid and sends all the robots to explore
- Source:
Returns:
- Type:
-
string
Indicates the final position and orientation of the robots in the grid and if they are lost