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,545 @@
|
|
1
|
+
require_relative '_test_helper'
|
2
|
+
|
3
|
+
describe Sashite::GGN::GameplayIntoBase64 do
|
4
|
+
describe '.new' do
|
5
|
+
before do
|
6
|
+
@gameplay_into_base64 = Sashite::GGN::GameplayIntoBase64.new('dDxzZWxmPl8mX15yZW1vdmVbLTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5fZW5lbXlfYWN0b3IrYWxsJXNlbGYuIHQ8c2VsZj5fJl9ecmVtb3ZlWzAsMV0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnJlbW92ZVsxLDBdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwlc2VsZi4gdDxzZWxmPl8mX15zaGlmdFstMSwwXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZi4gdDxzZWxmPl8mX15zaGlmdFstMSwwXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZjsgdDxzZWxmPl8mX15yZW1vdmVbLTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0WzAsLTFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0WzAsLTFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmOyB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5fZW5lbXlfYWN0b3IrYWxsJXNlbGYuIHQ8c2VsZj5fJl9ec2hpZnRbMCwxXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZi4gdDxzZWxmPl8mX15zaGlmdFswLDFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmOyB0PHNlbGY+XyZfXnJlbW92ZVswLDFdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwlc2VsZi4gdDxzZWxmPl8mX15zaGlmdFsxLDBdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0WzEsMF1fL3Q9X0BmK2FsbH5fQGYrYWxsJXNlbGY7IHQ8c2VsZj5fJl9ecmVtb3ZlWzEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLg==')
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'returns the GGN as a JSON' do
|
10
|
+
@gameplay_into_base64.as_json.hash.must_equal(
|
11
|
+
[
|
12
|
+
[
|
13
|
+
{
|
14
|
+
:"subject" => {
|
15
|
+
:"...ally?" => true,
|
16
|
+
:"actor" => :self,
|
17
|
+
:"state" => {
|
18
|
+
:"...last_moved_actor?" => nil,
|
19
|
+
:"...previous_moves_counter" => nil
|
20
|
+
}
|
21
|
+
},
|
22
|
+
|
23
|
+
:"verb" => {
|
24
|
+
:"name" => :remove,
|
25
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [-1,0]}
|
26
|
+
},
|
27
|
+
|
28
|
+
:"object" => {
|
29
|
+
:"src_square" => {
|
30
|
+
:"...attacked?" => nil,
|
31
|
+
:"...occupied!" => false,
|
32
|
+
:"area" => :all
|
33
|
+
},
|
34
|
+
:"dst_square" => {
|
35
|
+
:"...attacked?" => nil,
|
36
|
+
:"...occupied!" => :an_enemy_actor,
|
37
|
+
:"area" => :all
|
38
|
+
},
|
39
|
+
:"promotable_into_actors" => [:self]
|
40
|
+
}
|
41
|
+
}
|
42
|
+
],
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
[
|
47
|
+
{
|
48
|
+
:"subject" => {
|
49
|
+
:"...ally?" => true,
|
50
|
+
:"actor" => :self,
|
51
|
+
:"state" => {
|
52
|
+
:"...last_moved_actor?" => nil,
|
53
|
+
:"...previous_moves_counter" => nil
|
54
|
+
}
|
55
|
+
},
|
56
|
+
|
57
|
+
:"verb" => {
|
58
|
+
:"name" => :remove,
|
59
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [0,-1]}
|
60
|
+
},
|
61
|
+
|
62
|
+
:"object" => {
|
63
|
+
:"src_square" => {
|
64
|
+
:"...attacked?" => nil,
|
65
|
+
:"...occupied!" => false,
|
66
|
+
:"area" => :all
|
67
|
+
},
|
68
|
+
:"dst_square" => {
|
69
|
+
:"...attacked?" => nil,
|
70
|
+
:"...occupied!" => :an_enemy_actor,
|
71
|
+
:"area" => :all
|
72
|
+
},
|
73
|
+
:"promotable_into_actors" => [:self]
|
74
|
+
}
|
75
|
+
}
|
76
|
+
],
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
[
|
81
|
+
{
|
82
|
+
:"subject" => {
|
83
|
+
:"...ally?" => true,
|
84
|
+
:"actor" => :self,
|
85
|
+
:"state" => {
|
86
|
+
:"...last_moved_actor?" => nil,
|
87
|
+
:"...previous_moves_counter" => nil
|
88
|
+
}
|
89
|
+
},
|
90
|
+
|
91
|
+
:"verb" => {
|
92
|
+
:"name" => :remove,
|
93
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [0,1]}
|
94
|
+
},
|
95
|
+
|
96
|
+
:"object" => {
|
97
|
+
:"src_square" => {
|
98
|
+
:"...attacked?" => nil,
|
99
|
+
:"...occupied!" => false,
|
100
|
+
:"area" => :all
|
101
|
+
},
|
102
|
+
:"dst_square" => {
|
103
|
+
:"...attacked?" => nil,
|
104
|
+
:"...occupied!" => :an_enemy_actor,
|
105
|
+
:"area" => :all
|
106
|
+
},
|
107
|
+
:"promotable_into_actors" => [:self]
|
108
|
+
}
|
109
|
+
}
|
110
|
+
],
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
[
|
115
|
+
{
|
116
|
+
:"subject" => {
|
117
|
+
:"...ally?" => true,
|
118
|
+
:"actor" => :self,
|
119
|
+
:"state" => {
|
120
|
+
:"...last_moved_actor?" => nil,
|
121
|
+
:"...previous_moves_counter" => nil
|
122
|
+
}
|
123
|
+
},
|
124
|
+
|
125
|
+
:"verb" => {
|
126
|
+
:"name" => :remove,
|
127
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [1,0]}
|
128
|
+
},
|
129
|
+
|
130
|
+
:"object" => {
|
131
|
+
:"src_square" => {
|
132
|
+
:"...attacked?" => nil,
|
133
|
+
:"...occupied!" => false,
|
134
|
+
:"area" => :all
|
135
|
+
},
|
136
|
+
:"dst_square" => {
|
137
|
+
:"...attacked?" => nil,
|
138
|
+
:"...occupied!" => :an_enemy_actor,
|
139
|
+
:"area" => :all
|
140
|
+
},
|
141
|
+
:"promotable_into_actors" => [:self]
|
142
|
+
}
|
143
|
+
}
|
144
|
+
],
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
[
|
149
|
+
{
|
150
|
+
:"subject" => {
|
151
|
+
:"...ally?" => true,
|
152
|
+
:"actor" => :self,
|
153
|
+
:"state" => {
|
154
|
+
:"...last_moved_actor?" => nil,
|
155
|
+
:"...previous_moves_counter" => nil
|
156
|
+
}
|
157
|
+
},
|
158
|
+
|
159
|
+
:"verb" => {
|
160
|
+
:"name" => :shift,
|
161
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [-1,0]}
|
162
|
+
},
|
163
|
+
|
164
|
+
:"object" => {
|
165
|
+
:"src_square" => {
|
166
|
+
:"...attacked?" => nil,
|
167
|
+
:"...occupied!" => false,
|
168
|
+
:"area" => :all
|
169
|
+
},
|
170
|
+
:"dst_square" => {
|
171
|
+
:"...attacked?" => nil,
|
172
|
+
:"...occupied!" => false,
|
173
|
+
:"area" => :all
|
174
|
+
},
|
175
|
+
:"promotable_into_actors" => [:self]
|
176
|
+
}
|
177
|
+
}
|
178
|
+
],
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
[
|
183
|
+
{
|
184
|
+
:"subject" => {
|
185
|
+
:"...ally?" => true,
|
186
|
+
:"actor" => :self,
|
187
|
+
:"state" => {
|
188
|
+
:"...last_moved_actor?" => nil,
|
189
|
+
:"...previous_moves_counter" => nil
|
190
|
+
}
|
191
|
+
},
|
192
|
+
|
193
|
+
:"verb" => {
|
194
|
+
:"name" => :shift,
|
195
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [-1,0]}
|
196
|
+
},
|
197
|
+
|
198
|
+
:"object" => {
|
199
|
+
:"src_square" => {
|
200
|
+
:"...attacked?" => nil,
|
201
|
+
:"...occupied!" => false,
|
202
|
+
:"area" => :all
|
203
|
+
},
|
204
|
+
:"dst_square" => {
|
205
|
+
:"...attacked?" => nil,
|
206
|
+
:"...occupied!" => false,
|
207
|
+
:"area" => :all
|
208
|
+
},
|
209
|
+
:"promotable_into_actors" => [:self]
|
210
|
+
}
|
211
|
+
},
|
212
|
+
{
|
213
|
+
:"subject" => {
|
214
|
+
:"...ally?" => true,
|
215
|
+
:"actor" => :self,
|
216
|
+
:"state" => {
|
217
|
+
:"...last_moved_actor?" => nil,
|
218
|
+
:"...previous_moves_counter" => nil
|
219
|
+
}
|
220
|
+
},
|
221
|
+
|
222
|
+
:"verb" => {
|
223
|
+
:"name" => :remove,
|
224
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [-1,0]}
|
225
|
+
},
|
226
|
+
|
227
|
+
:"object" => {
|
228
|
+
:"src_square" => {
|
229
|
+
:"...attacked?" => nil,
|
230
|
+
:"...occupied!" => false,
|
231
|
+
:"area" => :all
|
232
|
+
},
|
233
|
+
:"dst_square" => {
|
234
|
+
:"...attacked?" => nil,
|
235
|
+
:"...occupied!" => :an_enemy_actor,
|
236
|
+
:"area" => :all
|
237
|
+
},
|
238
|
+
:"promotable_into_actors" => [:self]
|
239
|
+
}
|
240
|
+
}
|
241
|
+
],
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
[
|
246
|
+
{
|
247
|
+
:"subject" => {
|
248
|
+
:"...ally?" => true,
|
249
|
+
:"actor" => :self,
|
250
|
+
:"state" => {
|
251
|
+
:"...last_moved_actor?" => nil,
|
252
|
+
:"...previous_moves_counter" => nil
|
253
|
+
}
|
254
|
+
},
|
255
|
+
|
256
|
+
:"verb" => {
|
257
|
+
:"name" => :shift,
|
258
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [0,-1]}
|
259
|
+
},
|
260
|
+
|
261
|
+
:"object" => {
|
262
|
+
:"src_square" => {
|
263
|
+
:"...attacked?" => nil,
|
264
|
+
:"...occupied!" => false,
|
265
|
+
:"area" => :all
|
266
|
+
},
|
267
|
+
:"dst_square" => {
|
268
|
+
:"...attacked?" => nil,
|
269
|
+
:"...occupied!" => false,
|
270
|
+
:"area" => :all
|
271
|
+
},
|
272
|
+
:"promotable_into_actors" => [:self]
|
273
|
+
}
|
274
|
+
}
|
275
|
+
],
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
[
|
280
|
+
{
|
281
|
+
:"subject" => {
|
282
|
+
:"...ally?" => true,
|
283
|
+
:"actor" => :self,
|
284
|
+
:"state" => {
|
285
|
+
:"...last_moved_actor?" => nil,
|
286
|
+
:"...previous_moves_counter" => nil
|
287
|
+
}
|
288
|
+
},
|
289
|
+
|
290
|
+
:"verb" => {
|
291
|
+
:"name" => :shift,
|
292
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [0,-1]}
|
293
|
+
},
|
294
|
+
|
295
|
+
:"object" => {
|
296
|
+
:"src_square" => {
|
297
|
+
:"...attacked?" => nil,
|
298
|
+
:"...occupied!" => false,
|
299
|
+
:"area" => :all
|
300
|
+
},
|
301
|
+
:"dst_square" => {
|
302
|
+
:"...attacked?" => nil,
|
303
|
+
:"...occupied!" => false,
|
304
|
+
:"area" => :all
|
305
|
+
},
|
306
|
+
:"promotable_into_actors" => [:self]
|
307
|
+
}
|
308
|
+
},
|
309
|
+
{
|
310
|
+
:"subject" => {
|
311
|
+
:"...ally?" => true,
|
312
|
+
:"actor" => :self,
|
313
|
+
:"state" => {
|
314
|
+
:"...last_moved_actor?" => nil,
|
315
|
+
:"...previous_moves_counter" => nil
|
316
|
+
}
|
317
|
+
},
|
318
|
+
|
319
|
+
:"verb" => {
|
320
|
+
:"name" => :remove,
|
321
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [0,-1]}
|
322
|
+
},
|
323
|
+
|
324
|
+
:"object" => {
|
325
|
+
:"src_square" => {
|
326
|
+
:"...attacked?" => nil,
|
327
|
+
:"...occupied!" => false,
|
328
|
+
:"area" => :all
|
329
|
+
},
|
330
|
+
:"dst_square" => {
|
331
|
+
:"...attacked?" => nil,
|
332
|
+
:"...occupied!" => :an_enemy_actor,
|
333
|
+
:"area" => :all
|
334
|
+
},
|
335
|
+
:"promotable_into_actors" => [:self]
|
336
|
+
}
|
337
|
+
}
|
338
|
+
],
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
[
|
343
|
+
{
|
344
|
+
:"subject" => {
|
345
|
+
:"...ally?" => true,
|
346
|
+
:"actor" => :self,
|
347
|
+
:"state" => {
|
348
|
+
:"...last_moved_actor?" => nil,
|
349
|
+
:"...previous_moves_counter" => nil
|
350
|
+
}
|
351
|
+
},
|
352
|
+
|
353
|
+
:"verb" => {
|
354
|
+
:"name" => :shift,
|
355
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [0,1]}
|
356
|
+
},
|
357
|
+
|
358
|
+
:"object" => {
|
359
|
+
:"src_square" => {
|
360
|
+
:"...attacked?" => nil,
|
361
|
+
:"...occupied!" => false,
|
362
|
+
:"area" => :all
|
363
|
+
},
|
364
|
+
:"dst_square" => {
|
365
|
+
:"...attacked?" => nil,
|
366
|
+
:"...occupied!" => false,
|
367
|
+
:"area" => :all
|
368
|
+
},
|
369
|
+
:"promotable_into_actors" => [:self]
|
370
|
+
}
|
371
|
+
}
|
372
|
+
],
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
[
|
377
|
+
{
|
378
|
+
:"subject" => {
|
379
|
+
:"...ally?" => true,
|
380
|
+
:"actor" => :self,
|
381
|
+
:"state" => {
|
382
|
+
:"...last_moved_actor?" => nil,
|
383
|
+
:"...previous_moves_counter" => nil
|
384
|
+
}
|
385
|
+
},
|
386
|
+
|
387
|
+
:"verb" => {
|
388
|
+
:"name" => :shift,
|
389
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [0,1]}
|
390
|
+
},
|
391
|
+
|
392
|
+
:"object" => {
|
393
|
+
:"src_square" => {
|
394
|
+
:"...attacked?" => nil,
|
395
|
+
:"...occupied!" => false,
|
396
|
+
:"area" => :all
|
397
|
+
},
|
398
|
+
:"dst_square" => {
|
399
|
+
:"...attacked?" => nil,
|
400
|
+
:"...occupied!" => false,
|
401
|
+
:"area" => :all
|
402
|
+
},
|
403
|
+
:"promotable_into_actors" => [:self]
|
404
|
+
}
|
405
|
+
},
|
406
|
+
{
|
407
|
+
:"subject" => {
|
408
|
+
:"...ally?" => true,
|
409
|
+
:"actor" => :self,
|
410
|
+
:"state" => {
|
411
|
+
:"...last_moved_actor?" => nil,
|
412
|
+
:"...previous_moves_counter" => nil
|
413
|
+
}
|
414
|
+
},
|
415
|
+
|
416
|
+
:"verb" => {
|
417
|
+
:"name" => :remove,
|
418
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [0,1]}
|
419
|
+
},
|
420
|
+
|
421
|
+
:"object" => {
|
422
|
+
:"src_square" => {
|
423
|
+
:"...attacked?" => nil,
|
424
|
+
:"...occupied!" => false,
|
425
|
+
:"area" => :all
|
426
|
+
},
|
427
|
+
:"dst_square" => {
|
428
|
+
:"...attacked?" => nil,
|
429
|
+
:"...occupied!" => :an_enemy_actor,
|
430
|
+
:"area" => :all
|
431
|
+
},
|
432
|
+
:"promotable_into_actors" => [:self]
|
433
|
+
}
|
434
|
+
}
|
435
|
+
],
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
[
|
440
|
+
{
|
441
|
+
:"subject" => {
|
442
|
+
:"...ally?" => true,
|
443
|
+
:"actor" => :self,
|
444
|
+
:"state" => {
|
445
|
+
:"...last_moved_actor?" => nil,
|
446
|
+
:"...previous_moves_counter" => nil
|
447
|
+
}
|
448
|
+
},
|
449
|
+
|
450
|
+
:"verb" => {
|
451
|
+
:"name" => :shift,
|
452
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [1,0]}
|
453
|
+
},
|
454
|
+
|
455
|
+
:"object" => {
|
456
|
+
:"src_square" => {
|
457
|
+
:"...attacked?" => nil,
|
458
|
+
:"...occupied!" => false,
|
459
|
+
:"area" => :all
|
460
|
+
},
|
461
|
+
:"dst_square" => {
|
462
|
+
:"...attacked?" => nil,
|
463
|
+
:"...occupied!" => false,
|
464
|
+
:"area" => :all
|
465
|
+
},
|
466
|
+
:"promotable_into_actors" => [:self]
|
467
|
+
}
|
468
|
+
}
|
469
|
+
],
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
[
|
474
|
+
{
|
475
|
+
:"subject" => {
|
476
|
+
:"...ally?" => true,
|
477
|
+
:"actor" => :self,
|
478
|
+
:"state" => {
|
479
|
+
:"...last_moved_actor?" => nil,
|
480
|
+
:"...previous_moves_counter" => nil
|
481
|
+
}
|
482
|
+
},
|
483
|
+
|
484
|
+
:"verb" => {
|
485
|
+
:"name" => :shift,
|
486
|
+
:"vector" => {:"...maximum_magnitude" => nil, direction: [1,0]}
|
487
|
+
},
|
488
|
+
|
489
|
+
:"object" => {
|
490
|
+
:"src_square" => {
|
491
|
+
:"...attacked?" => nil,
|
492
|
+
:"...occupied!" => false,
|
493
|
+
:"area" => :all
|
494
|
+
},
|
495
|
+
:"dst_square" => {
|
496
|
+
:"...attacked?" => nil,
|
497
|
+
:"...occupied!" => false,
|
498
|
+
:"area" => :all
|
499
|
+
},
|
500
|
+
:"promotable_into_actors" => [:self]
|
501
|
+
}
|
502
|
+
},
|
503
|
+
{
|
504
|
+
:"subject" => {
|
505
|
+
:"...ally?" => true,
|
506
|
+
:"actor" => :self,
|
507
|
+
:"state" => {
|
508
|
+
:"...last_moved_actor?" => nil,
|
509
|
+
:"...previous_moves_counter" => nil
|
510
|
+
}
|
511
|
+
},
|
512
|
+
|
513
|
+
:"verb" => {
|
514
|
+
:"name" => :remove,
|
515
|
+
:"vector" => {:"...maximum_magnitude" => 1, direction: [1,0]}
|
516
|
+
},
|
517
|
+
|
518
|
+
:"object" => {
|
519
|
+
:"src_square" => {
|
520
|
+
:"...attacked?" => nil,
|
521
|
+
:"...occupied!" => false,
|
522
|
+
:"area" => :all
|
523
|
+
},
|
524
|
+
:"dst_square" => {
|
525
|
+
:"...attacked?" => nil,
|
526
|
+
:"...occupied!" => :an_enemy_actor,
|
527
|
+
:"area" => :all
|
528
|
+
},
|
529
|
+
:"promotable_into_actors" => [:self]
|
530
|
+
}
|
531
|
+
}
|
532
|
+
]
|
533
|
+
].hash
|
534
|
+
)
|
535
|
+
end
|
536
|
+
|
537
|
+
it 'returns the GGN as a string' do
|
538
|
+
@gameplay_into_base64.to_s.must_equal 'dDxzZWxmPl8mX15yZW1vdmVbLTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5fZW5lbXlfYWN0b3IrYWxsJXNlbGYuIHQ8c2VsZj5fJl9ecmVtb3ZlWzAsMV0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnJlbW92ZVsxLDBdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwlc2VsZi4gdDxzZWxmPl8mX15zaGlmdFstMSwwXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZi4gdDxzZWxmPl8mX15zaGlmdFstMSwwXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZjsgdDxzZWxmPl8mX15yZW1vdmVbLTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0WzAsLTFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0WzAsLTFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmOyB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5fZW5lbXlfYWN0b3IrYWxsJXNlbGYuIHQ8c2VsZj5fJl9ec2hpZnRbMCwxXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZi4gdDxzZWxmPl8mX15zaGlmdFswLDFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmOyB0PHNlbGY+XyZfXnJlbW92ZVswLDFdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwlc2VsZi4gdDxzZWxmPl8mX15zaGlmdFsxLDBdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0WzEsMF1fL3Q9X0BmK2FsbH5fQGYrYWxsJXNlbGY7IHQ8c2VsZj5fJl9ecmVtb3ZlWzEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLg=='
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
it 'raises an error' do
|
543
|
+
-> { Sashite::GGN::GameplayIntoBase64.new('foobar') }.must_raise ArgumentError
|
544
|
+
end
|
545
|
+
end
|