sashite-ggn 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -528
- data/VERSION.semver +1 -1
- data/lib/sashite/ggn.rb +2 -2
- data/lib/sashite/ggn/ability.rb +2 -20
- data/lib/sashite/ggn/gameplay.rb +2 -13
- data/lib/sashite/ggn/object.rb +2 -21
- data/lib/sashite/ggn/pattern.rb +2 -13
- data/lib/sashite/ggn/square.rb +2 -24
- data/lib/sashite/ggn/state.rb +2 -21
- data/lib/sashite/ggn/subject.rb +2 -22
- data/lib/sashite/ggn/verb.rb +2 -28
- data/sashite-ggn.gemspec +2 -2
- data/test/test_ggn.rb +6 -543
- data/test/test_ggn_ability.rb +28 -38
- data/test/test_ggn_gameplay.rb +8 -548
- data/test/test_ggn_object.rb +30 -22
- data/test/test_ggn_pattern.rb +8 -75
- data/test/test_ggn_square.rb +30 -14
- data/test/test_ggn_state.rb +18 -13
- data/test/test_ggn_subject.rb +30 -17
- data/test/test_ggn_verb.rb +18 -16
- metadata +4 -73
- data/lib/sashite/ggn/actor.rb +0 -20
- data/lib/sashite/ggn/ally.rb +0 -20
- data/lib/sashite/ggn/area.rb +0 -17
- data/lib/sashite/ggn/attacked.rb +0 -20
- data/lib/sashite/ggn/boolean.rb +0 -17
- data/lib/sashite/ggn/digit.rb +0 -20
- data/lib/sashite/ggn/digit_excluding_zero.rb +0 -17
- data/lib/sashite/ggn/direction.rb +0 -19
- data/lib/sashite/ggn/gameplay_into_base64.rb +0 -21
- data/lib/sashite/ggn/integer.rb +0 -20
- data/lib/sashite/ggn/last_moved_actor.rb +0 -20
- data/lib/sashite/ggn/maximum_magnitude.rb +0 -20
- data/lib/sashite/ggn/name.rb +0 -17
- data/lib/sashite/ggn/negative_integer.rb +0 -19
- data/lib/sashite/ggn/null.rb +0 -21
- data/lib/sashite/ggn/occupied.rb +0 -29
- data/lib/sashite/ggn/previous_moves_counter.rb +0 -20
- data/lib/sashite/ggn/promotable_into_actors.rb +0 -23
- data/lib/sashite/ggn/required.rb +0 -19
- data/lib/sashite/ggn/self.rb +0 -21
- data/lib/sashite/ggn/unsigned_integer.rb +0 -20
- data/lib/sashite/ggn/unsigned_integer_excluding_zero.rb +0 -20
- data/lib/sashite/ggn/zero.rb +0 -21
- data/test/test_ggn_actor.rb +0 -571
- data/test/test_ggn_ally.rb +0 -35
- data/test/test_ggn_area.rb +0 -21
- data/test/test_ggn_attacked.rb +0 -35
- data/test/test_ggn_boolean.rb +0 -21
- data/test/test_ggn_digit.rb +0 -21
- data/test/test_ggn_digit_excluding_zero.rb +0 -21
- data/test/test_ggn_direction.rb +0 -21
- data/test/test_ggn_gameplay_into_base64.rb +0 -555
- data/test/test_ggn_integer.rb +0 -39
- data/test/test_ggn_last_moved_actor.rb +0 -35
- data/test/test_ggn_maximum_magnitude.rb +0 -39
- data/test/test_ggn_name.rb +0 -21
- data/test/test_ggn_negative_integer.rb +0 -21
- data/test/test_ggn_null.rb +0 -21
- data/test/test_ggn_occupied.rb +0 -78
- data/test/test_ggn_previous_moves_counter.rb +0 -39
- data/test/test_ggn_promotable_into_actors.rb +0 -578
- data/test/test_ggn_required.rb +0 -21
- data/test/test_ggn_self.rb +0 -21
- data/test/test_ggn_unsigned_integer.rb +0 -39
- data/test/test_ggn_unsigned_integer_excluding_zero.rb +0 -25
- data/test/test_ggn_zero.rb +0 -21
data/VERSION.semver
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/sashite/ggn.rb
CHANGED
data/lib/sashite/ggn/ability.rb
CHANGED
@@ -4,26 +4,8 @@ require_relative 'object'
|
|
4
4
|
|
5
5
|
module Sashite
|
6
6
|
module GGN
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def self.valid? io
|
11
|
-
!!io.match("^#{PATTERN}$")
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.load io
|
15
|
-
raise ArgumentError unless valid? io
|
16
|
-
|
17
|
-
subject = Subject.load io.split('^').fetch 0
|
18
|
-
verb = Verb.load io.split('^').fetch(1).split('=').fetch 0
|
19
|
-
object = Object.load io.split('=').fetch 1
|
20
|
-
|
21
|
-
{
|
22
|
-
subject: subject,
|
23
|
-
verb: verb,
|
24
|
-
object: object
|
25
|
-
}
|
26
|
-
end
|
7
|
+
class Ability
|
8
|
+
attr_accessor :subject, :verb, :object
|
27
9
|
end
|
28
10
|
end
|
29
11
|
end
|
data/lib/sashite/ggn/gameplay.rb
CHANGED
@@ -2,19 +2,8 @@ require_relative 'pattern'
|
|
2
2
|
|
3
3
|
module Sashite
|
4
4
|
module GGN
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def self.valid? io
|
9
|
-
io.match("^#{PATTERN}$") &&
|
10
|
-
io.split('. ').sort.join('. ') == io &&
|
11
|
-
io[0..-2].split('. ').uniq.join('. ').concat('.') == io
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.load io
|
15
|
-
raise ArgumentError unless valid? io
|
16
|
-
io[0..-2].split('. ').map { |s| Pattern.load s }
|
17
|
-
end
|
5
|
+
class Gameplay
|
6
|
+
attr_accessor :patterns
|
18
7
|
end
|
19
8
|
end
|
20
9
|
end
|
data/lib/sashite/ggn/object.rb
CHANGED
@@ -1,28 +1,9 @@
|
|
1
1
|
require_relative 'square'
|
2
|
-
require_relative 'promotable_into_actors'
|
3
2
|
|
4
3
|
module Sashite
|
5
4
|
module GGN
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
def self.valid? io
|
10
|
-
!!io.match("^#{PATTERN}$")
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.load io
|
14
|
-
raise ArgumentError unless valid? io
|
15
|
-
|
16
|
-
src_square = Square.load io.split('~').fetch 0
|
17
|
-
dst_square = Square.load io.split('~').fetch(1).split('%').fetch 0
|
18
|
-
promotable_into_actors = PromotableIntoActors.load io.split('%').fetch 1
|
19
|
-
|
20
|
-
{
|
21
|
-
src_square: src_square,
|
22
|
-
dst_square: dst_square,
|
23
|
-
promotable_into_actors: promotable_into_actors
|
24
|
-
}
|
25
|
-
end
|
5
|
+
class Object
|
6
|
+
attr_accessor :src_square, :dst_square, :promotable_into_actors
|
26
7
|
end
|
27
8
|
end
|
28
9
|
end
|
data/lib/sashite/ggn/pattern.rb
CHANGED
@@ -2,19 +2,8 @@ require_relative 'ability'
|
|
2
2
|
|
3
3
|
module Sashite
|
4
4
|
module GGN
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def self.valid? io
|
9
|
-
io.match("^#{PATTERN}$") &&
|
10
|
-
io.split('; ').uniq.join('; ') == io
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.load io
|
14
|
-
raise ArgumentError unless valid? io
|
15
|
-
|
16
|
-
io.split('; ').map { |ability| Ability.load ability }
|
17
|
-
end
|
5
|
+
class Pattern
|
6
|
+
attr_accessor :abilities
|
18
7
|
end
|
19
8
|
end
|
20
9
|
end
|
data/lib/sashite/ggn/square.rb
CHANGED
@@ -1,29 +1,7 @@
|
|
1
|
-
require_relative 'attacked'
|
2
|
-
require_relative 'occupied'
|
3
|
-
require_relative 'area'
|
4
|
-
|
5
1
|
module Sashite
|
6
2
|
module GGN
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def self.valid? io
|
11
|
-
!!io.match("^#{PATTERN}$")
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.load io
|
15
|
-
raise ArgumentError unless valid? io
|
16
|
-
|
17
|
-
attacked = Attacked.load io.split('@').fetch(0)
|
18
|
-
occupied = Occupied.load io.split('@').fetch(1).split('+').fetch(0)
|
19
|
-
area = Area.load io.split('+').fetch(1)
|
20
|
-
|
21
|
-
{
|
22
|
-
:"...attacked?" => attacked,
|
23
|
-
:"...occupied!" => occupied,
|
24
|
-
:"area" => area
|
25
|
-
}
|
26
|
-
end
|
3
|
+
class Square
|
4
|
+
attr_accessor :attacked, :occupied, :area
|
27
5
|
end
|
28
6
|
end
|
29
7
|
end
|
data/lib/sashite/ggn/state.rb
CHANGED
@@ -1,26 +1,7 @@
|
|
1
|
-
require_relative 'last_moved_actor'
|
2
|
-
require_relative 'previous_moves_counter'
|
3
|
-
|
4
1
|
module Sashite
|
5
2
|
module GGN
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
def self.valid? io
|
10
|
-
!!io.match("^#{PATTERN}$")
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.load io
|
14
|
-
raise ArgumentError unless valid? io
|
15
|
-
|
16
|
-
last_moved_actor = LastMovedActor.load io.split('&').fetch(0)
|
17
|
-
previous_moves_counter = PreviousMovesCounter.load io.split('&').fetch(1)
|
18
|
-
|
19
|
-
{
|
20
|
-
:"...last_moved_actor?" => last_moved_actor,
|
21
|
-
:"...previous_moves_counter" => previous_moves_counter
|
22
|
-
}
|
23
|
-
end
|
3
|
+
class State
|
4
|
+
attr_accessor :last_moved_actor, :previous_moves_counter
|
24
5
|
end
|
25
6
|
end
|
26
7
|
end
|
data/lib/sashite/ggn/subject.rb
CHANGED
@@ -1,29 +1,9 @@
|
|
1
|
-
require_relative 'ally'
|
2
|
-
require_relative 'actor'
|
3
1
|
require_relative 'state'
|
4
2
|
|
5
3
|
module Sashite
|
6
4
|
module GGN
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def self.valid? io
|
11
|
-
!!io.match("^#{PATTERN}$")
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.load io
|
15
|
-
raise ArgumentError unless valid? io
|
16
|
-
|
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)
|
20
|
-
|
21
|
-
{
|
22
|
-
:"...ally?" => ally,
|
23
|
-
actor: actor,
|
24
|
-
state: state
|
25
|
-
}
|
26
|
-
end
|
5
|
+
class Subject
|
6
|
+
attr_accessor :ally, :actor, :state
|
27
7
|
end
|
28
8
|
end
|
29
9
|
end
|
data/lib/sashite/ggn/verb.rb
CHANGED
@@ -1,33 +1,7 @@
|
|
1
|
-
require_relative 'direction'
|
2
|
-
require_relative 'maximum_magnitude'
|
3
|
-
require_relative 'name'
|
4
|
-
require_relative 'required'
|
5
|
-
|
6
1
|
module Sashite
|
7
2
|
module GGN
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def self.valid? io
|
12
|
-
!!io.match("^#{PATTERN}$")
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.load io
|
16
|
-
raise ArgumentError unless valid? io
|
17
|
-
|
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
|
22
|
-
|
23
|
-
{
|
24
|
-
name: name,
|
25
|
-
vector: {
|
26
|
-
:"...maximum_magnitude" => maximum_magnitude,
|
27
|
-
direction: direction
|
28
|
-
}
|
29
|
-
}
|
30
|
-
end
|
3
|
+
class Verb
|
4
|
+
attr_accessor :name, :vector
|
31
5
|
end
|
32
6
|
end
|
33
7
|
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{
|
7
|
-
spec.description = %q{A Ruby interface for
|
6
|
+
spec.summary = %q{Some mappers for GGN objects}
|
7
|
+
spec.description = %q{A Ruby interface for GGN (General Gameplay Notation) objects.}
|
8
8
|
spec.homepage = 'https://github.com/sashite/ggn.rb'
|
9
9
|
spec.license = 'MIT'
|
10
10
|
|
data/test/test_ggn.rb
CHANGED
@@ -1,552 +1,15 @@
|
|
1
1
|
require_relative '_test_helper'
|
2
2
|
|
3
3
|
describe Sashite::GGN do
|
4
|
-
subject { Sashite::GGN }
|
4
|
+
subject { Sashite::GGN.new }
|
5
5
|
|
6
|
-
describe '
|
7
|
-
it '
|
8
|
-
subject.
|
9
|
-
't<self>_&_^remove[-1,0]1/t=_@f+all~_@an_enemy_actor+all%self. ' +
|
10
|
-
't<self>_&_^remove[0,-1]1/t=_@f+all~_@an_enemy_actor+all%self. ' +
|
11
|
-
't<self>_&_^remove[0,1]1/t=_@f+all~_@an_enemy_actor+all%self. ' +
|
12
|
-
't<self>_&_^remove[1,0]1/t=_@f+all~_@an_enemy_actor+all%self. ' +
|
13
|
-
't<self>_&_^shift[-1,0]_/t=_@f+all~_@f+all%self. ' +
|
14
|
-
'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. ' +
|
15
|
-
't<self>_&_^shift[0,-1]_/t=_@f+all~_@f+all%self. ' +
|
16
|
-
'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
|
-
't<self>_&_^shift[0,1]_/t=_@f+all~_@f+all%self. ' +
|
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. ' +
|
19
|
-
't<self>_&_^shift[1,0]_/t=_@f+all~_@f+all%self. ' +
|
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 [
|
22
|
-
[
|
23
|
-
{
|
24
|
-
:"subject" => {
|
25
|
-
:"...ally?" => true,
|
26
|
-
:"actor" => :self,
|
27
|
-
:"state" => {
|
28
|
-
:"...last_moved_actor?" => nil,
|
29
|
-
:"...previous_moves_counter" => nil
|
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
|
-
}
|
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
|
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
|
-
}
|
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
|
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
|
-
}
|
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
|
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
|
-
}
|
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
|
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
|
-
}
|
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
|
200
|
-
}
|
201
|
-
},
|
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
|
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
|
-
}
|
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
|
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
|
-
}
|
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
|
297
|
-
}
|
298
|
-
},
|
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
|
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
|
-
}
|
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
|
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
|
-
}
|
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
|
394
|
-
}
|
395
|
-
},
|
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
|
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
|
-
}
|
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
|
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
|
-
}
|
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
|
491
|
-
}
|
492
|
-
},
|
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
|
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
|
-
}
|
541
|
-
}
|
542
|
-
]
|
543
|
-
].hash
|
6
|
+
describe 'GGN instance' do
|
7
|
+
it 'responds to patterns' do
|
8
|
+
subject.must_respond_to :patterns
|
544
9
|
end
|
545
10
|
|
546
|
-
|
547
|
-
|
548
|
-
-> { subject.load 'foobar' }.must_raise ArgumentError
|
549
|
-
end
|
11
|
+
it 'responds to patterns=' do
|
12
|
+
subject.must_respond_to :patterns=
|
550
13
|
end
|
551
14
|
end
|
552
15
|
end
|