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