sashite-ggn 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +523 -521
  3. data/VERSION.semver +1 -1
  4. data/lib/sashite/ggn.rb +3 -2
  5. data/lib/sashite/ggn/ability.rb +11 -19
  6. data/lib/sashite/ggn/actor.rb +5 -13
  7. data/lib/sashite/ggn/ally.rb +6 -14
  8. data/lib/sashite/ggn/area.rb +6 -14
  9. data/lib/sashite/ggn/attacked.rb +6 -14
  10. data/lib/sashite/ggn/boolean.rb +6 -14
  11. data/lib/sashite/ggn/digit.rb +6 -14
  12. data/lib/sashite/ggn/digit_excluding_zero.rb +6 -14
  13. data/lib/sashite/ggn/direction.rb +6 -14
  14. data/lib/sashite/ggn/gameplay.rb +8 -28
  15. data/lib/sashite/ggn/gameplay_into_base64.rb +7 -14
  16. data/lib/sashite/ggn/integer.rb +6 -14
  17. data/lib/sashite/ggn/last_moved_actor.rb +6 -14
  18. data/lib/sashite/ggn/maximum_magnitude.rb +6 -14
  19. data/lib/sashite/ggn/name.rb +6 -14
  20. data/lib/sashite/ggn/negative_integer.rb +6 -14
  21. data/lib/sashite/ggn/null.rb +7 -9
  22. data/lib/sashite/ggn/object.rb +11 -19
  23. data/lib/sashite/ggn/occupied.rb +12 -20
  24. data/lib/sashite/ggn/pattern.rb +7 -16
  25. data/lib/sashite/ggn/previous_moves_counter.rb +6 -14
  26. data/lib/sashite/ggn/promotable_into_actors.rb +8 -17
  27. data/lib/sashite/ggn/required.rb +6 -14
  28. data/lib/sashite/ggn/self.rb +7 -9
  29. data/lib/sashite/ggn/square.rb +11 -19
  30. data/lib/sashite/ggn/state.rb +9 -17
  31. data/lib/sashite/ggn/subject.rb +11 -19
  32. data/lib/sashite/ggn/unsigned_integer.rb +6 -14
  33. data/lib/sashite/ggn/unsigned_integer_excluding_zero.rb +5 -13
  34. data/lib/sashite/ggn/verb.rb +15 -24
  35. data/lib/sashite/ggn/zero.rb +7 -9
  36. data/sashite-ggn.gemspec +2 -4
  37. data/test/test_ggn.rb +501 -495
  38. data/test/test_ggn_ability.rb +10 -10
  39. data/test/test_ggn_actor.rb +516 -536
  40. data/test/test_ggn_ally.rb +13 -29
  41. data/test/test_ggn_area.rb +9 -67
  42. data/test/test_ggn_attacked.rb +13 -29
  43. data/test/test_ggn_boolean.rb +10 -26
  44. data/test/test_ggn_digit.rb +10 -10
  45. data/test/test_ggn_digit_excluding_zero.rb +10 -11
  46. data/test/test_ggn_direction.rb +10 -10
  47. data/test/test_ggn_gameplay.rb +22 -38
  48. data/test/test_ggn_gameplay_into_base64.rb +511 -501
  49. data/test/test_ggn_integer.rb +19 -21
  50. data/test/test_ggn_last_moved_actor.rb +13 -29
  51. data/test/test_ggn_maximum_magnitude.rb +18 -16
  52. data/test/test_ggn_name.rb +9 -39
  53. data/test/test_ggn_negative_integer.rb +10 -10
  54. data/test/test_ggn_null.rb +10 -10
  55. data/test/test_ggn_object.rb +22 -24
  56. data/test/test_ggn_occupied.rb +40 -64
  57. data/test/test_ggn_pattern.rb +12 -10
  58. data/test/test_ggn_previous_moves_counter.rb +18 -20
  59. data/test/test_ggn_promotable_into_actors.rb +529 -549
  60. data/test/test_ggn_required.rb +10 -26
  61. data/test/test_ggn_self.rb +10 -10
  62. data/test/test_ggn_square.rb +14 -16
  63. data/test/test_ggn_state.rb +15 -19
  64. data/test/test_ggn_subject.rb +17 -19
  65. data/test/test_ggn_unsigned_integer.rb +30 -12
  66. data/test/test_ggn_unsigned_integer_excluding_zero.rb +14 -10
  67. data/test/test_ggn_verb.rb +16 -15
  68. data/test/test_ggn_zero.rb +10 -10
  69. metadata +4 -18
@@ -1,13 +1,15 @@
1
1
  require_relative '_test_helper'
2
2
 
3
3
  describe Sashite::GGN::Ability do
4
- describe '.new' do
4
+ subject { Sashite::GGN::Ability }
5
+
6
+ describe '.load' do
5
7
  before do
6
- @ability = Sashite::GGN::Ability.new('t<self>_&_^shift[-1,0]_/t=_@f+all~_@f+all%self')
8
+ @ggn_obj = 't<self>_&_^shift[-1,0]_/t=_@f+all~_@f+all%self'
7
9
  end
8
10
 
9
- it 'returns the GGN as a JSON' do
10
- @ability.as_json.hash.must_equal(
11
+ it 'loads a document from the current io stream' do
12
+ subject.load(@ggn_obj).hash.must_equal(
11
13
  {
12
14
  subject: {
13
15
  :"...ally?" => true,
@@ -40,12 +42,10 @@ describe Sashite::GGN::Ability do
40
42
  )
41
43
  end
42
44
 
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
+ describe 'errors' do
46
+ it 'raises without an ability' do
47
+ -> { subject.load 'foobar' }.must_raise ArgumentError
48
+ end
45
49
  end
46
50
  end
47
-
48
- it 'raises an error' do
49
- -> { Sashite::GGN::Ability.new('foobar') }.must_raise ArgumentError
50
- end
51
51
  end
@@ -1,591 +1,571 @@
1
1
  require_relative '_test_helper'
2
2
 
3
3
  describe Sashite::GGN::Actor do
4
- describe '.new' do
4
+ subject { Sashite::GGN::Actor }
5
+
6
+ describe '.load' do
5
7
  describe 'self' do
6
8
  before do
7
- @actor = Sashite::GGN::Actor.new('self')
9
+ @ggn_obj = 'self'
8
10
  end
9
11
 
10
- it 'returns the GGN as a JSON' do
11
- @actor.as_json.must_equal :self
12
+ it 'loads a document from the current io stream' do
13
+ subject.load(@ggn_obj).must_equal :self
12
14
  end
13
15
 
14
- it 'returns the GGN as a string' do
15
- @actor.to_s.must_equal 'self'
16
+ it 'raises an error' do
17
+ -> { subject.load 'foobar' }.must_raise ArgumentError
16
18
  end
17
19
  end
18
20
 
19
21
  describe 'gameplay into base64' do
20
22
  before do
21
- @actor = Sashite::GGN::Actor.new(
22
- 'dDxzZWxmPl8mX15yZW1vdmVbLTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxm' +
23
- 'LiB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5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x+X0BmK2FsbCVzZWxmOyB0PHNl' +
34
+ 'bGY+XyZfXnJlbW92ZVswLDFdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwlc2VsZi4gdDxz' +
35
+ 'ZWxmPl8mX15zaGlmdFsxLDBdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0' +
36
+ 'WzEsMF1fL3Q9X0BmK2FsbH5fQGYrYWxsJXNlbGY7IHQ8c2VsZj5fJl9ecmVtb3ZlWzEsMF0xL3Q9X0Bm' +
37
+ 'K2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLg=='
37
38
  end
38
39
 
39
- it 'returns the GGN as a JSON' do
40
- @actor.as_json.hash.must_equal(
40
+ it 'loads a document from the current io stream' do
41
+ subject.load(@ggn_obj).hash.must_equal [
41
42
  [
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]
43
+ {
44
+ :"subject" => {
45
+ :"...ally?" => true,
46
+ :"actor" => :self,
47
+ :"state" => {
48
+ :"...last_moved_actor?" => nil,
49
+ :"...previous_moves_counter" => nil
70
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]
71
70
  }
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]
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
104
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]
105
104
  }
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]
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
138
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]
139
138
  }
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]
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
172
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]
173
172
  }
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]
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
206
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]
207
206
  }
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]
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
240
220
  }
241
221
  },
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]
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
269
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]
270
269
  }
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]
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
303
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]
304
303
  }
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]
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
337
317
  }
338
318
  },
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]
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
366
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]
367
366
  }
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]
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
400
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]
401
400
  }
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]
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
434
414
  }
435
415
  },
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]
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
463
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]
464
463
  }
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]
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
497
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]
498
497
  }
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]
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
531
511
  }
532
512
  },
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]
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
560
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]
561
560
  }
562
- ]
563
- ].hash
564
- )
561
+ }
562
+ ]
563
+ ].hash
565
564
  end
566
565
 
567
- it 'returns the GGN as a string' do
568
- @actor.to_s.must_equal(
569
- 'dDxzZWxmPl8mX15yZW1vdmVbLTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxm' +
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0' +
582
- 'WzEsMF1fL3Q9X0BmK2FsbH5fQGYrYWxsJXNlbGY7IHQ8c2VsZj5fJl9ecmVtb3ZlWzEsMF0xL3Q9X0Bm' +
583
- 'K2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLg==')
566
+ it 'raises an error' do
567
+ -> { subject.load 'Zm9vYmFy' }.must_raise ArgumentError
584
568
  end
585
569
  end
586
570
  end
587
-
588
- it 'raises an error' do
589
- -> { Sashite::GGN::Actor.new('foobar') }.must_raise ArgumentError
590
- end
591
571
  end