You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Browser game for GitHub Pages (`npm run web:start`)
7
+
8
+
Both modes use the same simulator core and command rules.
9
+
3
10
## Instructions
4
11
5
-
This is a program that simulates a Toy Robot moving on a table top. The table top is a grid of 5 units x 5 units. There are no obstructions on the table surface. The Toy Robot is free to roam around the surface of the table, but must be prevented from falling to destruction. A failed or invalid command should not stop the simulation.
12
+
Toy Robot moves on a tabletop grid with no obstacles.
13
+
14
+
- Grid coordinates are `0..5` for both X and Y (6x6 board).
15
+
- Origin `(0,0)` is the south-west corner.
16
+
- Invalid/failed commands do not stop the simulation.
17
+
18
+
Commands:
6
19
7
-
-`PLACE X,Y,F` will place the Toy Robot on the table at position X,Y and facing direction F.
8
-
- Direction can be one of the cardinal points: `NORTH`, `EAST`, `SOUTH` or `WEST`.
9
-
-`MOVE` will move the Toy Robot one unit forward in the direction it is currently facing.
10
-
-`LEFT` will rotate the Toy Robot 90 degrees left (anti-clockwise/counter-clockwise).
11
-
-`RIGHT` will rotate the Toy Robot 90 degrees right (clockwise).
12
-
-`REPORT` will announce the X,Y,F of Toy Robot.
13
-
- Every command should provide visual output that the command has either succeeded or failed (display fail messages).
20
+
-`PLACE X,Y,F` places the robot at `X,Y` facing `F`.
21
+
-`MOVE` moves one unit forward.
22
+
-`LEFT` rotates 90 degrees anti-clockwise.
23
+
-`RIGHT` rotates 90 degrees clockwise.
24
+
-`REPORT` outputs `X,Y,F`.
25
+
26
+
Facing direction `F` must be one of:
27
+
28
+
-`NORTH`
29
+
-`EAST`
30
+
-`SOUTH`
31
+
-`WEST`
14
32
15
33
## Assumptions
16
34
17
-
- Successful commands are upper case (lower case letters would result fail).
18
-
- Allow empty space before/after commands (e.g. ` REPORT` or `PLACE 1,1,NORTH ` result success).
19
-
- Do not allow empty space between position X,Y,F (e.g. `PLACE ,,NORTH` will result fail).
20
-
- Origin (0,0) to be the SOUTH WEST most corner.
21
-
- Inputs are from standard input.
22
-
- Ignore any move that would cause the robot to fall and fail (remain the same state).
23
-
- Discard all commands in the sequence until a valid PLACE command has been executed.
24
-
- Current version installed
25
-
- npm: 10.2.4
26
-
- node: 20.11.0
27
-
- git: 2.39.2 (Apple Git-143)
35
+
- Commands are case-sensitive and must be uppercase.
36
+
- Leading/trailing spaces are allowed (for example ` REPORT`).
0 commit comments