another_toy_robot 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +53 -16
- data/lib/toy_robot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19356ced35855d3bd280b77f6ec6174698d4f8ba
|
4
|
+
data.tar.gz: 773afcf5e484aff26acc7db9c247c4164aae0d63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8775ee5ad28ec404de542c2b69b4585c67a7d46749570e68414bebd144e3e1e390dc3017742f909fdc7b137702a323bfe5ac9affd89b31542d3d4b7584daa153
|
7
|
+
data.tar.gz: 1e2ff237e8cdf6ad4bd7e46fa051613759f4ee8b4efd89e43d19899085f8c47638f06ec403a7c2a16a0ca497ab385e7aaa2a30167399406508ad75027803b4fb
|
data/README.md
CHANGED
@@ -1,9 +1,42 @@
|
|
1
1
|
[![Code Climate](https://codeclimate.com/github/drzel/toy_robot/badges/gpa.svg)](https://codeclimate.com/github/drzel/toy_robot)
|
2
2
|
[![Test Coverage](https://codeclimate.com/github/drzel/toy_robot/badges/coverage.svg)](https://codeclimate.com/github/drzel/toy_robot/coverage)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/another_toy_robot.svg)](https://badge.fury.io/rb/another_toy_robot)
|
3
4
|
|
4
|
-
#Toy Robot Simulator
|
5
|
+
# Another Toy Robot Simulator
|
6
|
+
The application is a simulation of a toy robot moving on a 5 x 5 unit tabletop. It
|
7
|
+
is an example of a well tested, object oriented design, employing the command design
|
8
|
+
pattern.
|
5
9
|
|
6
|
-
|
10
|
+
### Installation
|
11
|
+
```
|
12
|
+
gem install another_toy_robot
|
13
|
+
```
|
14
|
+
|
15
|
+
### Usage
|
16
|
+
```
|
17
|
+
toy_robot
|
18
|
+
```
|
19
|
+
|
20
|
+
This will present a prompt:
|
21
|
+
```
|
22
|
+
Input command:
|
23
|
+
```
|
24
|
+
|
25
|
+
Valid commands are:
|
26
|
+
|
27
|
+
| Command | Description
|
28
|
+
| ------------- | ---
|
29
|
+
| `place x,y,d` | Places robot at position `x`, `y`, facing cardinal direction `d`. E.g. `place 1,2,n`.
|
30
|
+
| `left` | Rotates robot 90° counter-clockwise.
|
31
|
+
| `right` | Rotates robot 90° clockwise.
|
32
|
+
| `move` | Advances the robot one position in the direction it is currently facing.
|
33
|
+
| `report` | Prints the current location.
|
34
|
+
|
35
|
+
Commands resulting in the robot moving to an out-of-bounds position (`x` or `y` being `< 0` or `> 4`) will be ignored.
|
36
|
+
|
37
|
+
## Specification
|
38
|
+
|
39
|
+
### Description
|
7
40
|
- The application is a simulation of a toy robot moving on a square tabletop,
|
8
41
|
of dimensions 5 units x 5 units.
|
9
42
|
- There are no other obstructions on the table surface.
|
@@ -13,13 +46,13 @@ robot falling from the table must be prevented, however further valid
|
|
13
46
|
movement commands must still be allowed.
|
14
47
|
- Create an application that can read in commands of the following form:
|
15
48
|
|
16
|
-
|
49
|
+
```
|
17
50
|
PLACE X,Y,F
|
18
51
|
MOVE
|
19
52
|
LEFT
|
20
53
|
RIGHT
|
21
54
|
REPORT
|
22
|
-
|
55
|
+
```
|
23
56
|
|
24
57
|
- PLACE will put the toy robot on the table in position X,Y and facing NORTH,
|
25
58
|
SOUTH, EAST or WEST.
|
@@ -39,41 +72,45 @@ and REPORT commands.
|
|
39
72
|
- Input can be from a file, or from standard input, as the developer chooses.
|
40
73
|
- Provide test data to exercise the application.
|
41
74
|
|
42
|
-
|
75
|
+
### Constraints
|
43
76
|
The toy robot must not fall off the table during movement. This also includes
|
44
77
|
the initial placement of the toy robot. Any move that would cause the robot
|
45
78
|
to fall must be ignored.
|
46
79
|
|
47
|
-
|
80
|
+
### Example Input and Output
|
48
81
|
a)
|
49
|
-
|
82
|
+
```
|
50
83
|
PLACE 0,0,NORTH
|
51
84
|
MOVE
|
52
85
|
REPORT
|
53
|
-
|
54
|
-
Output:
|
86
|
+
```
|
87
|
+
Output: `0,1,NORTH`
|
55
88
|
|
56
89
|
b)
|
57
|
-
|
90
|
+
```
|
58
91
|
PLACE 0,0,NORTH
|
59
92
|
LEFT
|
60
93
|
REPORT
|
61
|
-
|
62
|
-
Output:
|
94
|
+
```
|
95
|
+
Output: `0,0,WEST`
|
63
96
|
|
64
97
|
c)
|
65
|
-
|
98
|
+
```
|
66
99
|
PLACE 1,2,EAST
|
67
100
|
MOVE
|
68
101
|
MOVE
|
69
102
|
LEFT
|
70
103
|
MOVE
|
71
104
|
REPORT
|
72
|
-
|
73
|
-
Output:
|
105
|
+
```
|
106
|
+
Output: `3,3,NORTH`
|
74
107
|
|
75
|
-
|
108
|
+
### Deliverables
|
76
109
|
The source files, the test data and any test code.
|
77
110
|
|
78
111
|
It is not required to provide any graphical output showing the movement of the
|
79
112
|
toy robot.
|
113
|
+
|
114
|
+
## Acknowledgements
|
115
|
+
- [RafaelChefe's Toy Robot Simulator](https://github.com/RafaelChefe/toy_robot)
|
116
|
+
- [Wikipedia Command pattern article](https://en.wikipedia.org/wiki/Command_pattern)
|
data/lib/toy_robot/version.rb
CHANGED