loco_bot 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +6 -0
  5. data/Gemfile +3 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +393 -0
  8. data/Rakefile +9 -0
  9. data/bin/loco_bot_cli +10 -0
  10. data/lib/loco_bot/cli/command/base.rb +28 -0
  11. data/lib/loco_bot/cli/command/hodor.rb +14 -0
  12. data/lib/loco_bot/cli/command/left.rb +14 -0
  13. data/lib/loco_bot/cli/command/move.rb +14 -0
  14. data/lib/loco_bot/cli/command/place.rb +17 -0
  15. data/lib/loco_bot/cli/command/report.rb +18 -0
  16. data/lib/loco_bot/cli/command/right.rb +14 -0
  17. data/lib/loco_bot/cli/command.rb +34 -0
  18. data/lib/loco_bot/cli.rb +67 -0
  19. data/lib/loco_bot/robot/direction/east.rb +37 -0
  20. data/lib/loco_bot/robot/direction/north.rb +37 -0
  21. data/lib/loco_bot/robot/direction/south.rb +37 -0
  22. data/lib/loco_bot/robot/direction/west.rb +37 -0
  23. data/lib/loco_bot/robot/direction.rb +27 -0
  24. data/lib/loco_bot/robot.rb +102 -0
  25. data/lib/loco_bot/table.rb +94 -0
  26. data/lib/loco_bot/version.rb +4 -0
  27. data/lib/loco_bot.rb +8 -0
  28. data/loco_bot.gemspec +26 -0
  29. data/spec/loco_bot/cli/command/hodor_spec.rb +14 -0
  30. data/spec/loco_bot/cli/command/left_spec.rb +14 -0
  31. data/spec/loco_bot/cli/command/move_spec.rb +14 -0
  32. data/spec/loco_bot/cli/command/place_spec.rb +14 -0
  33. data/spec/loco_bot/cli/command/report_spec.rb +22 -0
  34. data/spec/loco_bot/cli/command/right_spec.rb +14 -0
  35. data/spec/loco_bot/cli/command_spec.rb +53 -0
  36. data/spec/loco_bot/cli_spec.rb +37 -0
  37. data/spec/loco_bot/robot/direction/east_spec.rb +25 -0
  38. data/spec/loco_bot/robot/direction/north_spec.rb +25 -0
  39. data/spec/loco_bot/robot/direction/south_spec.rb +25 -0
  40. data/spec/loco_bot/robot/direction/west_spec.rb +25 -0
  41. data/spec/loco_bot/robot/direction_spec.rb +35 -0
  42. data/spec/loco_bot/robot_spec.rb +247 -0
  43. data/spec/loco_bot/table_spec.rb +197 -0
  44. data/spec/spec_helper.rb +31 -0
  45. data/spec/support/test_1.txt +3 -0
  46. data/spec/support/test_2.txt +3 -0
  47. data/spec/support/test_3.txt +6 -0
  48. data/spec/support/test_4.txt +28 -0
  49. metadata +183 -0
@@ -0,0 +1,25 @@
1
+ RSpec.describe LocoBot::Robot::Direction::East do
2
+ describe '.left' do
3
+ subject { described_class.left }
4
+
5
+ it { is_expected.to eql LocoBot::Robot::Direction::North }
6
+ end
7
+
8
+ describe '.right' do
9
+ subject { described_class.right }
10
+
11
+ it { is_expected.to eql LocoBot::Robot::Direction::South }
12
+ end
13
+
14
+ describe '.label' do
15
+ subject { described_class.label }
16
+
17
+ it { is_expected.to eql 'EAST' }
18
+ end
19
+
20
+ describe '.coordinates' do
21
+ subject { described_class.coordinates(21, 17) }
22
+
23
+ it { is_expected.to eql({ x: 22, y: 17 }) }
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ RSpec.describe LocoBot::Robot::Direction::North do
2
+ describe '.left' do
3
+ subject { described_class.left }
4
+
5
+ it { is_expected.to eql LocoBot::Robot::Direction::West }
6
+ end
7
+
8
+ describe '.right' do
9
+ subject { described_class.right }
10
+
11
+ it { is_expected.to eql LocoBot::Robot::Direction::East }
12
+ end
13
+
14
+ describe '.label' do
15
+ subject { described_class.label }
16
+
17
+ it { is_expected.to eql 'NORTH' }
18
+ end
19
+
20
+ describe '.coordinates' do
21
+ subject { described_class.coordinates(21, 17) }
22
+
23
+ it { is_expected.to eql({ x: 21, y: 18 }) }
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ RSpec.describe LocoBot::Robot::Direction::South do
2
+ describe '.left' do
3
+ subject { described_class.left }
4
+
5
+ it { is_expected.to eql LocoBot::Robot::Direction::East }
6
+ end
7
+
8
+ describe '.right' do
9
+ subject { described_class.right }
10
+
11
+ it { is_expected.to eql LocoBot::Robot::Direction::West }
12
+ end
13
+
14
+ describe '.label' do
15
+ subject { described_class.label }
16
+
17
+ it { is_expected.to eql 'SOUTH' }
18
+ end
19
+
20
+ describe '.coordinates' do
21
+ subject { described_class.coordinates(21, 17) }
22
+
23
+ it { is_expected.to eql({ x: 21, y: 16 }) }
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ RSpec.describe LocoBot::Robot::Direction::West do
2
+ describe '.left' do
3
+ subject { described_class.left }
4
+
5
+ it { is_expected.to eql LocoBot::Robot::Direction::South }
6
+ end
7
+
8
+ describe '.right' do
9
+ subject { described_class.right }
10
+
11
+ it { is_expected.to eql LocoBot::Robot::Direction::North }
12
+ end
13
+
14
+ describe '.label' do
15
+ subject { described_class.label }
16
+
17
+ it { is_expected.to eql 'WEST' }
18
+ end
19
+
20
+ describe '.coordinates' do
21
+ subject { described_class.coordinates(21, 17) }
22
+
23
+ it { is_expected.to eql({ x: 20, y: 17 }) }
24
+ end
25
+ end
@@ -0,0 +1,35 @@
1
+ RSpec.describe LocoBot::Robot::Direction do
2
+ describe '.list' do
3
+ subject { described_class.list }
4
+
5
+ it { is_expected.to eql ['East', 'North', 'South', 'West'] }
6
+ end
7
+
8
+ describe '.from_name' do
9
+ subject { described_class.from_name(direction) }
10
+
11
+ context 'passing :north' do
12
+ let(:direction) { :north }
13
+
14
+ it { is_expected.to eql LocoBot::Robot::Direction::North }
15
+ end
16
+
17
+ context 'passing :east' do
18
+ let(:direction) { :east }
19
+
20
+ it { is_expected.to eql LocoBot::Robot::Direction::East }
21
+ end
22
+
23
+ context 'passing :south' do
24
+ let(:direction) { :south }
25
+
26
+ it { is_expected.to eql LocoBot::Robot::Direction::South }
27
+ end
28
+
29
+ context 'passing :west' do
30
+ let(:direction) { :west }
31
+
32
+ it { is_expected.to eql LocoBot::Robot::Direction::West }
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,247 @@
1
+ RSpec.describe LocoBot::Robot do
2
+ let(:robot) { described_class.new }
3
+ let(:table) { LocoBot::Table.new(20, 20) }
4
+
5
+ describe '#place' do
6
+ subject { robot }
7
+
8
+ it 'calls Table#place_robot' do
9
+ expect(table).to receive(:place_robot).with(subject, 9, 3, LocoBot::Robot::Direction::East).once
10
+
11
+ subject.place(table, 9, 3, LocoBot::Robot::Direction::East)
12
+ end
13
+ end
14
+
15
+ describe '#remove' do
16
+ subject { robot.remove }
17
+
18
+ context 'when placed on a table' do
19
+ before { robot.place(table, 6, 17, LocoBot::Robot::Direction::East) }
20
+
21
+ it 'calls Table#remove_robot' do
22
+ expect(table).to receive(:remove_robot).with(robot).once
23
+
24
+ subject
25
+ end
26
+ end
27
+
28
+ context 'when not placed on a table' do
29
+ it { expect(subject).to be false }
30
+ end
31
+ end
32
+
33
+ describe '#move' do
34
+ subject { robot }
35
+
36
+ before { robot.place(table, x, y, direction) }
37
+
38
+ context 'facing north' do
39
+ let(:direction) { LocoBot::Robot::Direction::North }
40
+ let(:x) { 10 }
41
+
42
+ context 'when movement is possible' do
43
+ let(:y) { 0 }
44
+
45
+ it 'moves north' do
46
+ expect { subject.move }.to change { subject.y }.to(1)
47
+ expect { subject.move }.not_to change { subject.x }
48
+ end
49
+ end
50
+
51
+ context 'when movement is not possible' do
52
+ let(:y) { 19 }
53
+
54
+ it 'does not move' do
55
+ expect { subject.move }.not_to change { subject.x }
56
+ expect { subject.move }.not_to change { subject.y }
57
+ end
58
+ end
59
+ end
60
+
61
+ context 'facing south' do
62
+ let(:direction) { LocoBot::Robot::Direction::South }
63
+ let(:x) { 10 }
64
+
65
+ context 'when movement is possible' do
66
+ let(:y) { 19 }
67
+
68
+ it 'moves south' do
69
+ expect { subject.move }.to change { subject.y }.to(18)
70
+ expect { subject.move }.not_to change { subject.x }
71
+ end
72
+ end
73
+
74
+ context 'when movement is not possible' do
75
+ let(:y) { 0 }
76
+
77
+ it 'does not move' do
78
+ expect { subject.move }.not_to change { subject.x }
79
+ expect { subject.move }.not_to change { subject.y }
80
+ end
81
+ end
82
+ end
83
+
84
+ context 'facing east' do
85
+ let(:direction) { LocoBot::Robot::Direction::East }
86
+ let(:y) { 10 }
87
+
88
+ context 'when movement is possible' do
89
+ let(:x) { 0 }
90
+
91
+ it 'moves east' do
92
+ expect { subject.move }.to change { subject.x }.to(1)
93
+ expect { subject.move }.not_to change { subject.y }
94
+ end
95
+ end
96
+
97
+ context 'when movement is not possible' do
98
+ let(:x) { 19 }
99
+
100
+ it 'does not move' do
101
+ expect { subject.move }.not_to change { subject.x }
102
+ expect { subject.move }.not_to change { subject.y }
103
+ end
104
+ end
105
+ end
106
+
107
+ context 'facing west' do
108
+ let(:direction) { LocoBot::Robot::Direction::West }
109
+ let(:y) { 10 }
110
+
111
+ context 'when movement is possible' do
112
+ let(:x) { 19 }
113
+
114
+ it 'moves west' do
115
+ expect { subject.move }.to change { subject.x }.to(18)
116
+ expect { subject.move }.not_to change { subject.y }
117
+ end
118
+ end
119
+
120
+ context 'when movement is not possible' do
121
+ let(:x) { 0 }
122
+
123
+ it 'does not move' do
124
+ expect { subject.move }.not_to change { subject.x }
125
+ expect { subject.move }.not_to change { subject.y }
126
+ end
127
+ end
128
+ end
129
+ end
130
+
131
+ describe '#turn_left' do
132
+ subject { robot }
133
+
134
+ before { subject.place(table, 10, 10, direction) }
135
+
136
+ context 'facing north' do
137
+ let(:direction) { LocoBot::Robot::Direction::North }
138
+
139
+ it { expect { subject.turn_left }.to change { subject.direction }.to LocoBot::Robot::Direction::West }
140
+ end
141
+
142
+ context 'facing south' do
143
+ let(:direction) { LocoBot::Robot::Direction::South }
144
+
145
+ it { expect { subject.turn_left }.to change { subject.direction }.to LocoBot::Robot::Direction::East }
146
+ end
147
+
148
+ context 'facing east' do
149
+ let(:direction) { LocoBot::Robot::Direction::East }
150
+
151
+ it { expect { subject.turn_left }.to change { subject.direction }.to LocoBot::Robot::Direction::North }
152
+ end
153
+
154
+ context 'facing west' do
155
+ let(:direction) { LocoBot::Robot::Direction::West }
156
+
157
+ it { expect { subject.turn_left }.to change { subject.direction }.to LocoBot::Robot::Direction::South }
158
+ end
159
+ end
160
+
161
+ describe '#turn_right' do
162
+ subject { robot }
163
+
164
+ before { subject.place(table, 10, 10, direction) }
165
+
166
+ context 'facing north' do
167
+ let(:direction) { LocoBot::Robot::Direction::North }
168
+
169
+ it { expect { subject.turn_right }.to change { subject.direction }.to LocoBot::Robot::Direction::East }
170
+ end
171
+
172
+ context 'facing south' do
173
+ let(:direction) { LocoBot::Robot::Direction::South }
174
+
175
+ it { expect { subject.turn_right }.to change { subject.direction }.to LocoBot::Robot::Direction::West }
176
+ end
177
+
178
+ context 'facing east' do
179
+ let(:direction) { LocoBot::Robot::Direction::East }
180
+
181
+ it { expect { subject.turn_right }.to change { subject.direction }.to LocoBot::Robot::Direction::South }
182
+ end
183
+
184
+ context 'facing west' do
185
+ let(:direction) { LocoBot::Robot::Direction::West }
186
+
187
+ it { expect { subject.turn_right }.to change { subject.direction }.to LocoBot::Robot::Direction::North }
188
+ end
189
+ end
190
+
191
+ describe '#report' do
192
+ subject { robot.report }
193
+
194
+ context 'when placed on a table' do
195
+ before { robot.place(table, 6, 17, LocoBot::Robot::Direction::East) }
196
+
197
+ it { is_expected.to eql({x: 6, y: 17, direction: LocoBot::Robot::Direction::East}) }
198
+ end
199
+
200
+ context 'when not placed on a table' do
201
+ it 'returns an empty Hash' do
202
+ expect(subject).to be_a Hash
203
+ expect(subject).to be_empty
204
+ end
205
+ end
206
+ end
207
+
208
+ describe '#hodor!' do
209
+ it { expect { robot.hodor! }.to output("HODOR HODOR !\n").to_stdout }
210
+ end
211
+
212
+ describe '#next_position' do
213
+ subject { robot.next_position }
214
+
215
+ context 'when not placed on a table' do
216
+ it { is_expected.to eql({}) }
217
+ end
218
+
219
+ context 'when placed on a table' do
220
+ before { robot.place(table, 10, 10, direction) }
221
+
222
+ context 'facing north' do
223
+ let(:direction) { LocoBot::Robot::Direction::North }
224
+
225
+ it { is_expected.to eql({x: 10, y: 11}) }
226
+ end
227
+
228
+ context 'facing south' do
229
+ let(:direction) { LocoBot::Robot::Direction::South }
230
+
231
+ it { is_expected.to eql({x: 10, y: 9}) }
232
+ end
233
+
234
+ context 'facing east' do
235
+ let(:direction) { LocoBot::Robot::Direction::East }
236
+
237
+ it { is_expected.to eql({x: 11, y: 10}) }
238
+ end
239
+
240
+ context 'facing west' do
241
+ let(:direction) { LocoBot::Robot::Direction::West }
242
+
243
+ it { is_expected.to eql({x: 9, y: 10}) }
244
+ end
245
+ end
246
+ end
247
+ end
@@ -0,0 +1,197 @@
1
+ RSpec.describe LocoBot::Table do
2
+ describe '#initialize' do
3
+ subject { described_class.new(width, height) }
4
+ let(:width) { 8 }
5
+ let(:height) { 3 }
6
+
7
+ it { expect(subject.width).to eql 8 }
8
+ it { expect(subject.height).to eql 3 }
9
+ it { expect(subject.robots).to be_empty }
10
+
11
+ context 'with an invalid width' do
12
+ let(:width) { 0 }
13
+
14
+ it { expect{ subject }.to(raise_error(ArgumentError)) }
15
+ end
16
+
17
+ context 'with an invalid height' do
18
+ let(:height) { -5 }
19
+
20
+ it { expect{ subject }.to(raise_error(ArgumentError)) }
21
+ end
22
+
23
+ context 'with an invalid width and height' do
24
+ let(:width) { -16 }
25
+ let(:height) { 0 }
26
+
27
+ it { expect{ subject }.to(raise_error(ArgumentError)) }
28
+ end
29
+ end
30
+
31
+ describe '#place_robot' do
32
+ let(:table) { described_class.new(15, 15) }
33
+ let(:other_table) { described_class.new(10, 10) }
34
+ let(:robot) { LocoBot::Robot.new }
35
+
36
+ before { other_table.place_robot(robot, 5, 7, LocoBot::Robot::Direction::West) }
37
+
38
+ context 'with a valid position' do
39
+ it 'modifies the robot lists' do
40
+ expect(other_table.robots).to include(robot)
41
+ expect(table.robots).not_to include(robot)
42
+
43
+ table.place_robot(robot, 12, 14, LocoBot::Robot::Direction::South)
44
+
45
+ expect(other_table.robots).not_to include(robot)
46
+ expect(table.robots).to include(robot)
47
+ end
48
+
49
+ it 'changes the robot table, x, y and position' do
50
+ expect(robot.table).to eql other_table
51
+ expect(robot.x).to eql 5
52
+ expect(robot.y).to eql 7
53
+ expect(robot.direction).to eql LocoBot::Robot::Direction::West
54
+
55
+ table.place_robot(robot, 12, 14, LocoBot::Robot::Direction::South)
56
+
57
+ expect(robot.table).to eql table
58
+ expect(robot.x).to eql 12
59
+ expect(robot.y).to eql 14
60
+ expect(robot.direction).to eql LocoBot::Robot::Direction::South
61
+ end
62
+
63
+ it { expect(table.place_robot(robot, 12, 14, LocoBot::Robot::Direction::South)).to be true }
64
+ end
65
+
66
+ context 'with an invalid position' do
67
+ it 'does not modify the robot lists' do
68
+ expect(other_table.robots).to include(robot)
69
+ expect(table.robots).not_to include(robot)
70
+
71
+ table.place_robot(robot, 617, 9001, LocoBot::Robot::Direction::South)
72
+
73
+ expect(other_table.robots).to include(robot)
74
+ expect(table.robots).not_to include(robot)
75
+ end
76
+
77
+ it 'does not change the robot table, x, y and position' do
78
+ expect(robot.table).to eql other_table
79
+ expect(robot.x).to eql 5
80
+ expect(robot.y).to eql 7
81
+ expect(robot.direction).to eql LocoBot::Robot::Direction::West
82
+
83
+ table.place_robot(robot, 617, 9001, LocoBot::Robot::Direction::South)
84
+
85
+ expect(robot.table).to eql other_table
86
+ expect(robot.x).to eql 5
87
+ expect(robot.y).to eql 7
88
+ expect(robot.direction).to eql LocoBot::Robot::Direction::West
89
+ end
90
+
91
+ it { expect(table.place_robot(robot, 617, 9001, LocoBot::Robot::Direction::South)).to be false }
92
+ end
93
+ end
94
+
95
+ describe '#remove_robot' do
96
+ let(:table) { described_class.new(10, 10) }
97
+ let(:robot) { LocoBot::Robot.new }
98
+
99
+ before do
100
+ table.place_robot(LocoBot::Robot.new, 3, 4, LocoBot::Robot::Direction::North)
101
+ table.place_robot(LocoBot::Robot.new, 1, 8, LocoBot::Robot::Direction::West)
102
+ LocoBot::Table.new.place_robot(robot, 1, 3, LocoBot::Robot::Direction::South)
103
+ end
104
+
105
+ context 'with a robot on another table' do
106
+ let(:other_table) { described_class.new(20, 20) }
107
+
108
+ before do
109
+ other_table.place_robot(robot, 1, 3, LocoBot::Robot::Direction::South)
110
+ end
111
+
112
+ it 'does not modify the robot list' do
113
+ expect(table.robots.count).to eql 2
114
+ expect(table.robots).not_to include(robot)
115
+
116
+ table.remove_robot(robot)
117
+
118
+ expect(table.robots.count).to eql 2
119
+ expect(table.robots).not_to include(robot)
120
+ end
121
+
122
+ it 'does not set to nil robot table, x, y and direction' do
123
+ expect(robot.table).to eql other_table
124
+ expect(robot.x).to eql 1
125
+ expect(robot.y).to eql 3
126
+ expect(robot.direction).to eql LocoBot::Robot::Direction::South
127
+
128
+ table.remove_robot(robot)
129
+
130
+ expect(robot.table).to eql other_table
131
+ expect(robot.x).to eql 1
132
+ expect(robot.y).to eql 3
133
+ expect(robot.direction).to eql LocoBot::Robot::Direction::South
134
+ end
135
+
136
+ it { expect(table.remove_robot(robot)).to be false }
137
+ end
138
+
139
+ context 'with the robot on the table' do
140
+ before { table.place_robot(robot, 5, 3, LocoBot::Robot::Direction::East) }
141
+
142
+ it 'removes the robot from the list' do
143
+ expect(table.robots.count).to eql 3
144
+ expect(table.robots).to include(robot)
145
+
146
+ table.remove_robot(robot)
147
+
148
+ expect(table.robots.count).to eql 2
149
+ expect(table.robots).not_to include(robot)
150
+ end
151
+
152
+ it 'sets to nil robot table, x, y and direction' do
153
+ expect(robot.table).to eql table
154
+ expect(robot.x).to eql 5
155
+ expect(robot.y).to eql 3
156
+ expect(robot.direction).to eql LocoBot::Robot::Direction::East
157
+
158
+ table.remove_robot(robot)
159
+
160
+ expect(robot.table).to be_nil
161
+ expect(robot.x).to be_nil
162
+ expect(robot.y).to be_nil
163
+ expect(robot.direction).to be_nil
164
+ end
165
+
166
+ it { expect(table.remove_robot(robot)).to be true }
167
+ end
168
+ end
169
+
170
+ describe '#position_valid?' do
171
+ subject { table.position_valid?(x, y) }
172
+ let(:table) { described_class.new(10, 5) }
173
+
174
+ context 'with an out of bounds position' do
175
+ let(:x) { 5 }
176
+ let(:y) { 6 }
177
+
178
+ it { is_expected.to be false }
179
+ end
180
+
181
+ context 'with an occupied position' do
182
+ let(:x) { 2 }
183
+ let(:y) { 3 }
184
+
185
+ before { table.place_robot(LocoBot::Robot.new, 2, 3, LocoBot::Robot::Direction::North) }
186
+
187
+ it { is_expected.to be false }
188
+ end
189
+
190
+ context 'with a free position within bounds' do
191
+ let(:x) { 3 }
192
+ let(:y) { 1 }
193
+
194
+ it { is_expected.to be true }
195
+ end
196
+ end
197
+ end
@@ -0,0 +1,31 @@
1
+ require 'codeclimate-test-reporter'
2
+ CodeClimate::TestReporter.start
3
+
4
+ require 'simplecov'
5
+ SimpleCov.start do
6
+ add_filter "/spec/"
7
+ end
8
+
9
+ require 'loco_bot'
10
+
11
+ RSpec.configure do |config|
12
+ config.expect_with :rspec do |expectations|
13
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
14
+ end
15
+
16
+ config.mock_with :rspec do |mocks|
17
+ mocks.verify_partial_doubles = true
18
+ end
19
+
20
+ config.disable_monkey_patching!
21
+
22
+ # Many RSpec users commonly either run the entire suite or an individual
23
+ # file, and it's useful to allow more verbose output when running an
24
+ # individual spec file.
25
+ if config.files_to_run.one?
26
+ # Use the documentation formatter for detailed output,
27
+ # unless a formatter has already been configured
28
+ # (e.g. via a command-line flag).
29
+ config.default_formatter = 'doc'
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ PLACE 0,0,NORTH
2
+ MOVE
3
+ REPORT
@@ -0,0 +1,3 @@
1
+ PLACE 0,0,NORTH
2
+ LEFT
3
+ REPORT
@@ -0,0 +1,6 @@
1
+ PLACE 1,2,EAST
2
+ MOVE
3
+ MOVE
4
+ LEFT
5
+ MOVE
6
+ REPORT
@@ -0,0 +1,28 @@
1
+ PLACE 4,4,NORTH
2
+ MOVE
3
+ MOVE
4
+ RIGHT
5
+ MOVE
6
+ REPORT
7
+
8
+ RIGHT
9
+ MOVE
10
+ MOVE
11
+ RIGHT
12
+ MOVE
13
+ MOVE
14
+ LEFT
15
+ MOVE
16
+ REPORT
17
+
18
+ PLACE 1,6,WEST
19
+ REPORT
20
+
21
+ PLACE 1,4,WEST
22
+ MOVE
23
+ MOVE
24
+ LEFT
25
+ MOVE
26
+ LEFT
27
+ MOVE
28
+ REPORT