sashite-ggn 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +2 -0
- data/LICENSE.md +22 -0
- data/README.md +566 -0
- data/Rakefile +7 -0
- data/VERSION.semver +1 -0
- data/lib/sashite-ggn.rb +1 -0
- data/lib/sashite/ggn.rb +9 -0
- data/lib/sashite/ggn/ability.rb +37 -0
- data/lib/sashite/ggn/actor.rb +28 -0
- data/lib/sashite/ggn/ally.rb +28 -0
- data/lib/sashite/ggn/area.rb +25 -0
- data/lib/sashite/ggn/attacked.rb +28 -0
- data/lib/sashite/ggn/boolean.rb +25 -0
- data/lib/sashite/ggn/digit.rb +28 -0
- data/lib/sashite/ggn/digit_excluding_zero.rb +25 -0
- data/lib/sashite/ggn/direction.rb +27 -0
- data/lib/sashite/ggn/gameplay.rb +40 -0
- data/lib/sashite/ggn/gameplay_into_base64.rb +28 -0
- data/lib/sashite/ggn/integer.rb +28 -0
- data/lib/sashite/ggn/last_moved_actor.rb +28 -0
- data/lib/sashite/ggn/maximum_magnitude.rb +28 -0
- data/lib/sashite/ggn/name.rb +25 -0
- data/lib/sashite/ggn/negative_integer.rb +27 -0
- data/lib/sashite/ggn/null.rb +23 -0
- data/lib/sashite/ggn/object.rb +36 -0
- data/lib/sashite/ggn/occupied.rb +37 -0
- data/lib/sashite/ggn/pattern.rb +29 -0
- data/lib/sashite/ggn/previous_moves_counter.rb +28 -0
- data/lib/sashite/ggn/promotable_into_actors.rb +32 -0
- data/lib/sashite/ggn/required.rb +27 -0
- data/lib/sashite/ggn/self.rb +23 -0
- data/lib/sashite/ggn/square.rb +37 -0
- data/lib/sashite/ggn/state.rb +34 -0
- data/lib/sashite/ggn/subject.rb +37 -0
- data/lib/sashite/ggn/unsigned_integer.rb +28 -0
- data/lib/sashite/ggn/unsigned_integer_excluding_zero.rb +28 -0
- data/lib/sashite/ggn/verb.rb +42 -0
- data/lib/sashite/ggn/zero.rb +23 -0
- data/sashite-ggn.gemspec +21 -0
- data/test/_test_helper.rb +2 -0
- data/test/test_ggn.rb +546 -0
- data/test/test_ggn_ability.rb +51 -0
- data/test/test_ggn_actor.rb +591 -0
- data/test/test_ggn_ally.rb +51 -0
- data/test/test_ggn_area.rb +79 -0
- data/test/test_ggn_attacked.rb +51 -0
- data/test/test_ggn_boolean.rb +37 -0
- data/test/test_ggn_digit.rb +21 -0
- data/test/test_ggn_digit_excluding_zero.rb +22 -0
- data/test/test_ggn_direction.rb +21 -0
- data/test/test_ggn_gameplay.rb +573 -0
- data/test/test_ggn_gameplay_into_base64.rb +545 -0
- data/test/test_ggn_integer.rb +41 -0
- data/test/test_ggn_last_moved_actor.rb +51 -0
- data/test/test_ggn_maximum_magnitude.rb +37 -0
- data/test/test_ggn_name.rb +51 -0
- data/test/test_ggn_negative_integer.rb +21 -0
- data/test/test_ggn_null.rb +21 -0
- data/test/test_ggn_object.rb +35 -0
- data/test/test_ggn_occupied.rb +102 -0
- data/test/test_ggn_pattern.rb +82 -0
- data/test/test_ggn_previous_moves_counter.rb +41 -0
- data/test/test_ggn_promotable_into_actors.rb +598 -0
- data/test/test_ggn_required.rb +37 -0
- data/test/test_ggn_self.rb +21 -0
- data/test/test_ggn_square.rb +27 -0
- data/test/test_ggn_state.rb +28 -0
- data/test/test_ggn_subject.rb +30 -0
- data/test/test_ggn_unsigned_integer.rb +21 -0
- data/test/test_ggn_unsigned_integer_excluding_zero.rb +21 -0
- data/test/test_ggn_verb.rb +26 -0
- data/test/test_ggn_zero.rb +21 -0
- metadata +208 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
require_relative '_test_helper'
|
2
|
+
|
3
|
+
describe Sashite::GGN::PreviousMovesCounter do
|
4
|
+
describe '.new' do
|
5
|
+
describe 'null' do
|
6
|
+
before do
|
7
|
+
@previous_moves_counter = Sashite::GGN::PreviousMovesCounter.new('_')
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'returns the GGN as a JSON' do
|
11
|
+
@previous_moves_counter.as_json.must_equal nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'returns the GGN as a string' do
|
15
|
+
@previous_moves_counter.to_s.must_equal '_'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'raises an error' do
|
19
|
+
-> { Sashite::GGN::PreviousMovesCounter.new('foobar') }.must_raise ArgumentError
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'unsigned integer' do
|
24
|
+
before do
|
25
|
+
@previous_moves_counter = Sashite::GGN::PreviousMovesCounter.new('42')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'returns the GGN as a JSON' do
|
29
|
+
@previous_moves_counter.as_json.must_equal 42
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'returns the GGN as a string' do
|
33
|
+
@previous_moves_counter.to_s.must_equal '42'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'raises an error' do
|
37
|
+
-> { Sashite::GGN::PreviousMovesCounter.new('-42') }.must_raise ArgumentError
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,598 @@
|
|
1
|
+
require_relative '_test_helper'
|
2
|
+
|
3
|
+
describe Sashite::GGN::PromotableIntoActors do
|
4
|
+
describe '.new' do
|
5
|
+
describe 'self' do
|
6
|
+
before do
|
7
|
+
@promotable_into_actors = Sashite::GGN::PromotableIntoActors.new('self')
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'returns the GGN as a JSON' do
|
11
|
+
@promotable_into_actors.as_json.hash.must_equal [:self].hash
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'returns the GGN as a string' do
|
15
|
+
@promotable_into_actors.to_s.must_equal 'self'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'raises an error' do
|
19
|
+
-> { Sashite::GGN::PromotableIntoActors.new('foobar') }.must_raise ArgumentError
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'gameplay into base64 and self' do
|
24
|
+
before do
|
25
|
+
@promotable_into_actors = Sashite::GGN::PromotableIntoActors.new(
|
26
|
+
'dDxzZWxmPl8mX15yZW1vdmVbLTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxm' +
|
27
|
+
'LiB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5fZW5lbXlfYWN0b3IrYWxsJXNl' +
|
28
|
+
'bGYuIHQ8c2VsZj5fJl9ecmVtb3ZlWzAsMV0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVz' +
|
29
|
+
'ZWxmLiB0PHNlbGY+XyZfXnJlbW92ZVsxLDBdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwl' +
|
30
|
+
'c2VsZi4gdDxzZWxmPl8mX15zaGlmdFstMSwwXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZi4gdDxzZWxm' +
|
31
|
+
'Pl8mX15zaGlmdFstMSwwXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZjsgdDxzZWxmPl8mX15yZW1vdmVb' +
|
32
|
+
'LTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0' +
|
33
|
+
'WzAsLTFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0WzAsLTFdXy90PV9A' +
|
34
|
+
'ZithbGx+X0BmK2FsbCVzZWxmOyB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5f' +
|
35
|
+
'ZW5lbXlfYWN0b3IrYWxsJXNlbGYuIHQ8c2VsZj5fJl9ec2hpZnRbMCwxXV8vdD1fQGYrYWxsfl9AZith' +
|
36
|
+
'bGwlc2VsZi4gdDxzZWxmPl8mX15zaGlmdFswLDFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmOyB0PHNl' +
|
37
|
+
'bGY+XyZfXnJlbW92ZVswLDFdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwlc2VsZi4gdDxz' +
|
38
|
+
'ZWxmPl8mX15zaGlmdFsxLDBdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0' +
|
39
|
+
'WzEsMF1fL3Q9X0BmK2FsbH5fQGYrYWxsJXNlbGY7IHQ8c2VsZj5fJl9ecmVtb3ZlWzEsMF0xL3Q9X0Bm' +
|
40
|
+
'K2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLg==,self')
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'returns the GGN as a JSON' do
|
44
|
+
@promotable_into_actors.as_json.hash.must_equal(
|
45
|
+
[
|
46
|
+
[
|
47
|
+
[
|
48
|
+
{
|
49
|
+
:"subject" => {
|
50
|
+
:"...ally?" => true,
|
51
|
+
:"actor" => :self,
|
52
|
+
:"state" => {
|
53
|
+
:"...last_moved_actor?" => nil,
|
54
|
+
:"...previous_moves_counter" => nil
|
55
|
+
}
|
56
|
+
},
|
57
|
+
|
58
|
+
:"verb" => {
|
59
|
+
:"name" => :remove,
|
60
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [-1,0]}
|
61
|
+
},
|
62
|
+
|
63
|
+
:"object" => {
|
64
|
+
:"src_square" => {
|
65
|
+
:"...attacked?" => nil,
|
66
|
+
:"...occupied!" => false,
|
67
|
+
:"area" => :all
|
68
|
+
},
|
69
|
+
:"dst_square" => {
|
70
|
+
:"...attacked?" => nil,
|
71
|
+
:"...occupied!" => :an_enemy_actor,
|
72
|
+
:"area" => :all
|
73
|
+
},
|
74
|
+
:"promotable_into_actors" => [:self]
|
75
|
+
}
|
76
|
+
}
|
77
|
+
],
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
[
|
82
|
+
{
|
83
|
+
:"subject" => {
|
84
|
+
:"...ally?" => true,
|
85
|
+
:"actor" => :self,
|
86
|
+
:"state" => {
|
87
|
+
:"...last_moved_actor?" => nil,
|
88
|
+
:"...previous_moves_counter" => nil
|
89
|
+
}
|
90
|
+
},
|
91
|
+
|
92
|
+
:"verb" => {
|
93
|
+
:"name" => :remove,
|
94
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [0,-1]}
|
95
|
+
},
|
96
|
+
|
97
|
+
:"object" => {
|
98
|
+
:"src_square" => {
|
99
|
+
:"...attacked?" => nil,
|
100
|
+
:"...occupied!" => false,
|
101
|
+
:"area" => :all
|
102
|
+
},
|
103
|
+
:"dst_square" => {
|
104
|
+
:"...attacked?" => nil,
|
105
|
+
:"...occupied!" => :an_enemy_actor,
|
106
|
+
:"area" => :all
|
107
|
+
},
|
108
|
+
:"promotable_into_actors" => [:self]
|
109
|
+
}
|
110
|
+
}
|
111
|
+
],
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
[
|
116
|
+
{
|
117
|
+
:"subject" => {
|
118
|
+
:"...ally?" => true,
|
119
|
+
:"actor" => :self,
|
120
|
+
:"state" => {
|
121
|
+
:"...last_moved_actor?" => nil,
|
122
|
+
:"...previous_moves_counter" => nil
|
123
|
+
}
|
124
|
+
},
|
125
|
+
|
126
|
+
:"verb" => {
|
127
|
+
:"name" => :remove,
|
128
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [0,1]}
|
129
|
+
},
|
130
|
+
|
131
|
+
:"object" => {
|
132
|
+
:"src_square" => {
|
133
|
+
:"...attacked?" => nil,
|
134
|
+
:"...occupied!" => false,
|
135
|
+
:"area" => :all
|
136
|
+
},
|
137
|
+
:"dst_square" => {
|
138
|
+
:"...attacked?" => nil,
|
139
|
+
:"...occupied!" => :an_enemy_actor,
|
140
|
+
:"area" => :all
|
141
|
+
},
|
142
|
+
:"promotable_into_actors" => [:self]
|
143
|
+
}
|
144
|
+
}
|
145
|
+
],
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
[
|
150
|
+
{
|
151
|
+
:"subject" => {
|
152
|
+
:"...ally?" => true,
|
153
|
+
:"actor" => :self,
|
154
|
+
:"state" => {
|
155
|
+
:"...last_moved_actor?" => nil,
|
156
|
+
:"...previous_moves_counter" => nil
|
157
|
+
}
|
158
|
+
},
|
159
|
+
|
160
|
+
:"verb" => {
|
161
|
+
:"name" => :remove,
|
162
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [1,0]}
|
163
|
+
},
|
164
|
+
|
165
|
+
:"object" => {
|
166
|
+
:"src_square" => {
|
167
|
+
:"...attacked?" => nil,
|
168
|
+
:"...occupied!" => false,
|
169
|
+
:"area" => :all
|
170
|
+
},
|
171
|
+
:"dst_square" => {
|
172
|
+
:"...attacked?" => nil,
|
173
|
+
:"...occupied!" => :an_enemy_actor,
|
174
|
+
:"area" => :all
|
175
|
+
},
|
176
|
+
:"promotable_into_actors" => [:self]
|
177
|
+
}
|
178
|
+
}
|
179
|
+
],
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
[
|
184
|
+
{
|
185
|
+
:"subject" => {
|
186
|
+
:"...ally?" => true,
|
187
|
+
:"actor" => :self,
|
188
|
+
:"state" => {
|
189
|
+
:"...last_moved_actor?" => nil,
|
190
|
+
:"...previous_moves_counter" => nil
|
191
|
+
}
|
192
|
+
},
|
193
|
+
|
194
|
+
:"verb" => {
|
195
|
+
:"name" => :shift,
|
196
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [-1,0]}
|
197
|
+
},
|
198
|
+
|
199
|
+
:"object" => {
|
200
|
+
:"src_square" => {
|
201
|
+
:"...attacked?" => nil,
|
202
|
+
:"...occupied!" => false,
|
203
|
+
:"area" => :all
|
204
|
+
},
|
205
|
+
:"dst_square" => {
|
206
|
+
:"...attacked?" => nil,
|
207
|
+
:"...occupied!" => false,
|
208
|
+
:"area" => :all
|
209
|
+
},
|
210
|
+
:"promotable_into_actors" => [:self]
|
211
|
+
}
|
212
|
+
}
|
213
|
+
],
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
[
|
218
|
+
{
|
219
|
+
:"subject" => {
|
220
|
+
:"...ally?" => true,
|
221
|
+
:"actor" => :self,
|
222
|
+
:"state" => {
|
223
|
+
:"...last_moved_actor?" => nil,
|
224
|
+
:"...previous_moves_counter" => nil
|
225
|
+
}
|
226
|
+
},
|
227
|
+
|
228
|
+
:"verb" => {
|
229
|
+
:"name" => :shift,
|
230
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [-1,0]}
|
231
|
+
},
|
232
|
+
|
233
|
+
:"object" => {
|
234
|
+
:"src_square" => {
|
235
|
+
:"...attacked?" => nil,
|
236
|
+
:"...occupied!" => false,
|
237
|
+
:"area" => :all
|
238
|
+
},
|
239
|
+
:"dst_square" => {
|
240
|
+
:"...attacked?" => nil,
|
241
|
+
:"...occupied!" => false,
|
242
|
+
:"area" => :all
|
243
|
+
},
|
244
|
+
:"promotable_into_actors" => [:self]
|
245
|
+
}
|
246
|
+
},
|
247
|
+
{
|
248
|
+
:"subject" => {
|
249
|
+
:"...ally?" => true,
|
250
|
+
:"actor" => :self,
|
251
|
+
:"state" => {
|
252
|
+
:"...last_moved_actor?" => nil,
|
253
|
+
:"...previous_moves_counter" => nil
|
254
|
+
}
|
255
|
+
},
|
256
|
+
|
257
|
+
:"verb" => {
|
258
|
+
:"name" => :remove,
|
259
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [-1,0]}
|
260
|
+
},
|
261
|
+
|
262
|
+
:"object" => {
|
263
|
+
:"src_square" => {
|
264
|
+
:"...attacked?" => nil,
|
265
|
+
:"...occupied!" => false,
|
266
|
+
:"area" => :all
|
267
|
+
},
|
268
|
+
:"dst_square" => {
|
269
|
+
:"...attacked?" => nil,
|
270
|
+
:"...occupied!" => :an_enemy_actor,
|
271
|
+
:"area" => :all
|
272
|
+
},
|
273
|
+
:"promotable_into_actors" => [:self]
|
274
|
+
}
|
275
|
+
}
|
276
|
+
],
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
[
|
281
|
+
{
|
282
|
+
:"subject" => {
|
283
|
+
:"...ally?" => true,
|
284
|
+
:"actor" => :self,
|
285
|
+
:"state" => {
|
286
|
+
:"...last_moved_actor?" => nil,
|
287
|
+
:"...previous_moves_counter" => nil
|
288
|
+
}
|
289
|
+
},
|
290
|
+
|
291
|
+
:"verb" => {
|
292
|
+
:"name" => :shift,
|
293
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [0,-1]}
|
294
|
+
},
|
295
|
+
|
296
|
+
:"object" => {
|
297
|
+
:"src_square" => {
|
298
|
+
:"...attacked?" => nil,
|
299
|
+
:"...occupied!" => false,
|
300
|
+
:"area" => :all
|
301
|
+
},
|
302
|
+
:"dst_square" => {
|
303
|
+
:"...attacked?" => nil,
|
304
|
+
:"...occupied!" => false,
|
305
|
+
:"area" => :all
|
306
|
+
},
|
307
|
+
:"promotable_into_actors" => [:self]
|
308
|
+
}
|
309
|
+
}
|
310
|
+
],
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
[
|
315
|
+
{
|
316
|
+
:"subject" => {
|
317
|
+
:"...ally?" => true,
|
318
|
+
:"actor" => :self,
|
319
|
+
:"state" => {
|
320
|
+
:"...last_moved_actor?" => nil,
|
321
|
+
:"...previous_moves_counter" => nil
|
322
|
+
}
|
323
|
+
},
|
324
|
+
|
325
|
+
:"verb" => {
|
326
|
+
:"name" => :shift,
|
327
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [0,-1]}
|
328
|
+
},
|
329
|
+
|
330
|
+
:"object" => {
|
331
|
+
:"src_square" => {
|
332
|
+
:"...attacked?" => nil,
|
333
|
+
:"...occupied!" => false,
|
334
|
+
:"area" => :all
|
335
|
+
},
|
336
|
+
:"dst_square" => {
|
337
|
+
:"...attacked?" => nil,
|
338
|
+
:"...occupied!" => false,
|
339
|
+
:"area" => :all
|
340
|
+
},
|
341
|
+
:"promotable_into_actors" => [:self]
|
342
|
+
}
|
343
|
+
},
|
344
|
+
{
|
345
|
+
:"subject" => {
|
346
|
+
:"...ally?" => true,
|
347
|
+
:"actor" => :self,
|
348
|
+
:"state" => {
|
349
|
+
:"...last_moved_actor?" => nil,
|
350
|
+
:"...previous_moves_counter" => nil
|
351
|
+
}
|
352
|
+
},
|
353
|
+
|
354
|
+
:"verb" => {
|
355
|
+
:"name" => :remove,
|
356
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [0,-1]}
|
357
|
+
},
|
358
|
+
|
359
|
+
:"object" => {
|
360
|
+
:"src_square" => {
|
361
|
+
:"...attacked?" => nil,
|
362
|
+
:"...occupied!" => false,
|
363
|
+
:"area" => :all
|
364
|
+
},
|
365
|
+
:"dst_square" => {
|
366
|
+
:"...attacked?" => nil,
|
367
|
+
:"...occupied!" => :an_enemy_actor,
|
368
|
+
:"area" => :all
|
369
|
+
},
|
370
|
+
:"promotable_into_actors" => [:self]
|
371
|
+
}
|
372
|
+
}
|
373
|
+
],
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
[
|
378
|
+
{
|
379
|
+
:"subject" => {
|
380
|
+
:"...ally?" => true,
|
381
|
+
:"actor" => :self,
|
382
|
+
:"state" => {
|
383
|
+
:"...last_moved_actor?" => nil,
|
384
|
+
:"...previous_moves_counter" => nil
|
385
|
+
}
|
386
|
+
},
|
387
|
+
|
388
|
+
:"verb" => {
|
389
|
+
:"name" => :shift,
|
390
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [0,1]}
|
391
|
+
},
|
392
|
+
|
393
|
+
:"object" => {
|
394
|
+
:"src_square" => {
|
395
|
+
:"...attacked?" => nil,
|
396
|
+
:"...occupied!" => false,
|
397
|
+
:"area" => :all
|
398
|
+
},
|
399
|
+
:"dst_square" => {
|
400
|
+
:"...attacked?" => nil,
|
401
|
+
:"...occupied!" => false,
|
402
|
+
:"area" => :all
|
403
|
+
},
|
404
|
+
:"promotable_into_actors" => [:self]
|
405
|
+
}
|
406
|
+
}
|
407
|
+
],
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
[
|
412
|
+
{
|
413
|
+
:"subject" => {
|
414
|
+
:"...ally?" => true,
|
415
|
+
:"actor" => :self,
|
416
|
+
:"state" => {
|
417
|
+
:"...last_moved_actor?" => nil,
|
418
|
+
:"...previous_moves_counter" => nil
|
419
|
+
}
|
420
|
+
},
|
421
|
+
|
422
|
+
:"verb" => {
|
423
|
+
:"name" => :shift,
|
424
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [0,1]}
|
425
|
+
},
|
426
|
+
|
427
|
+
:"object" => {
|
428
|
+
:"src_square" => {
|
429
|
+
:"...attacked?" => nil,
|
430
|
+
:"...occupied!" => false,
|
431
|
+
:"area" => :all
|
432
|
+
},
|
433
|
+
:"dst_square" => {
|
434
|
+
:"...attacked?" => nil,
|
435
|
+
:"...occupied!" => false,
|
436
|
+
:"area" => :all
|
437
|
+
},
|
438
|
+
:"promotable_into_actors" => [:self]
|
439
|
+
}
|
440
|
+
},
|
441
|
+
{
|
442
|
+
:"subject" => {
|
443
|
+
:"...ally?" => true,
|
444
|
+
:"actor" => :self,
|
445
|
+
:"state" => {
|
446
|
+
:"...last_moved_actor?" => nil,
|
447
|
+
:"...previous_moves_counter" => nil
|
448
|
+
}
|
449
|
+
},
|
450
|
+
|
451
|
+
:"verb" => {
|
452
|
+
:"name" => :remove,
|
453
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [0,1]}
|
454
|
+
},
|
455
|
+
|
456
|
+
:"object" => {
|
457
|
+
:"src_square" => {
|
458
|
+
:"...attacked?" => nil,
|
459
|
+
:"...occupied!" => false,
|
460
|
+
:"area" => :all
|
461
|
+
},
|
462
|
+
:"dst_square" => {
|
463
|
+
:"...attacked?" => nil,
|
464
|
+
:"...occupied!" => :an_enemy_actor,
|
465
|
+
:"area" => :all
|
466
|
+
},
|
467
|
+
:"promotable_into_actors" => [:self]
|
468
|
+
}
|
469
|
+
}
|
470
|
+
],
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
[
|
475
|
+
{
|
476
|
+
:"subject" => {
|
477
|
+
:"...ally?" => true,
|
478
|
+
:"actor" => :self,
|
479
|
+
:"state" => {
|
480
|
+
:"...last_moved_actor?" => nil,
|
481
|
+
:"...previous_moves_counter" => nil
|
482
|
+
}
|
483
|
+
},
|
484
|
+
|
485
|
+
:"verb" => {
|
486
|
+
:"name" => :shift,
|
487
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [1,0]}
|
488
|
+
},
|
489
|
+
|
490
|
+
:"object" => {
|
491
|
+
:"src_square" => {
|
492
|
+
:"...attacked?" => nil,
|
493
|
+
:"...occupied!" => false,
|
494
|
+
:"area" => :all
|
495
|
+
},
|
496
|
+
:"dst_square" => {
|
497
|
+
:"...attacked?" => nil,
|
498
|
+
:"...occupied!" => false,
|
499
|
+
:"area" => :all
|
500
|
+
},
|
501
|
+
:"promotable_into_actors" => [:self]
|
502
|
+
}
|
503
|
+
}
|
504
|
+
],
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
[
|
509
|
+
{
|
510
|
+
:"subject" => {
|
511
|
+
:"...ally?" => true,
|
512
|
+
:"actor" => :self,
|
513
|
+
:"state" => {
|
514
|
+
:"...last_moved_actor?" => nil,
|
515
|
+
:"...previous_moves_counter" => nil
|
516
|
+
}
|
517
|
+
},
|
518
|
+
|
519
|
+
:"verb" => {
|
520
|
+
:"name" => :shift,
|
521
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [1,0]}
|
522
|
+
},
|
523
|
+
|
524
|
+
:"object" => {
|
525
|
+
:"src_square" => {
|
526
|
+
:"...attacked?" => nil,
|
527
|
+
:"...occupied!" => false,
|
528
|
+
:"area" => :all
|
529
|
+
},
|
530
|
+
:"dst_square" => {
|
531
|
+
:"...attacked?" => nil,
|
532
|
+
:"...occupied!" => false,
|
533
|
+
:"area" => :all
|
534
|
+
},
|
535
|
+
:"promotable_into_actors" => [:self]
|
536
|
+
}
|
537
|
+
},
|
538
|
+
{
|
539
|
+
:"subject" => {
|
540
|
+
:"...ally?" => true,
|
541
|
+
:"actor" => :self,
|
542
|
+
:"state" => {
|
543
|
+
:"...last_moved_actor?" => nil,
|
544
|
+
:"...previous_moves_counter" => nil
|
545
|
+
}
|
546
|
+
},
|
547
|
+
|
548
|
+
:"verb" => {
|
549
|
+
:"name" => :remove,
|
550
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [1,0]}
|
551
|
+
},
|
552
|
+
|
553
|
+
:"object" => {
|
554
|
+
:"src_square" => {
|
555
|
+
:"...attacked?" => nil,
|
556
|
+
:"...occupied!" => false,
|
557
|
+
:"area" => :all
|
558
|
+
},
|
559
|
+
:"dst_square" => {
|
560
|
+
:"...attacked?" => nil,
|
561
|
+
:"...occupied!" => :an_enemy_actor,
|
562
|
+
:"area" => :all
|
563
|
+
},
|
564
|
+
:"promotable_into_actors" => [:self]
|
565
|
+
}
|
566
|
+
}
|
567
|
+
]
|
568
|
+
],
|
569
|
+
:self
|
570
|
+
].hash
|
571
|
+
)
|
572
|
+
end
|
573
|
+
|
574
|
+
it 'returns the GGN as a string' do
|
575
|
+
@promotable_into_actors.to_s.must_equal(
|
576
|
+
'dDxzZWxmPl8mX15yZW1vdmVbLTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxm' +
|
577
|
+
'LiB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5fZW5lbXlfYWN0b3IrYWxsJXNl' +
|
578
|
+
'bGYuIHQ8c2VsZj5fJl9ecmVtb3ZlWzAsMV0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVz' +
|
579
|
+
'ZWxmLiB0PHNlbGY+XyZfXnJlbW92ZVsxLDBdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwl' +
|
580
|
+
'c2VsZi4gdDxzZWxmPl8mX15zaGlmdFstMSwwXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZi4gdDxzZWxm' +
|
581
|
+
'Pl8mX15zaGlmdFstMSwwXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZjsgdDxzZWxmPl8mX15yZW1vdmVb' +
|
582
|
+
'LTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0' +
|
583
|
+
'WzAsLTFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0WzAsLTFdXy90PV9A' +
|
584
|
+
'ZithbGx+X0BmK2FsbCVzZWxmOyB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5f' +
|
585
|
+
'ZW5lbXlfYWN0b3IrYWxsJXNlbGYuIHQ8c2VsZj5fJl9ec2hpZnRbMCwxXV8vdD1fQGYrYWxsfl9AZith' +
|
586
|
+
'bGwlc2VsZi4gdDxzZWxmPl8mX15zaGlmdFswLDFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmOyB0PHNl' +
|
587
|
+
'bGY+XyZfXnJlbW92ZVswLDFdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwlc2VsZi4gdDxz' +
|
588
|
+
'ZWxmPl8mX15zaGlmdFsxLDBdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0' +
|
589
|
+
'WzEsMF1fL3Q9X0BmK2FsbH5fQGYrYWxsJXNlbGY7IHQ8c2VsZj5fJl9ecmVtb3ZlWzEsMF0xL3Q9X0Bm' +
|
590
|
+
'K2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLg==,self')
|
591
|
+
end
|
592
|
+
end
|
593
|
+
end
|
594
|
+
|
595
|
+
it 'raises an error' do
|
596
|
+
-> { Sashite::GGN::PromotableIntoActors.new('foobar') }.must_raise ArgumentError
|
597
|
+
end
|
598
|
+
end
|