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