generated from grepsedawk/sharded.cr
/
robotchallenge
42 lines (39 loc) · 834 Bytes
/
robotchallenge
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Create a command line app that prompts for commands and moves a rover around a 2D plane.
The robot should point in a direction, turn to face different directions, and move in the direction it is facing.
starts at 0,0 facing north
Hello! Robot coming online.
Command the robot with:
L - turn left
R - turn right
M - move forward
? - this message
Q - quit
> M
Robot at (0, 1) facing North
> L
Robot at (0, 1) facing West
> M
Robot at (-1, 1) facing West
> M
Robot at (-2, 1) facing West
> L
Robot at (-2, 1) facing South
> M
Robot at (-2, 0) facing South
> R
Robot at (-2, 0) facing West
> R
Robot at (-2, 0) facing North
> R
Robot at (-2, 0) facing East
> M
Robot at (-1, 0) facing East
> ?
Command the robot with:
L - turn left
R - turn right
M - move forward
? - this message
Q - quit
> Q
Robot shutting down.