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