sashite-ggn 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/LICENSE.md +17 -18
- data/README.md +356 -506
- data/lib/sashite/ggn/piece/source/destination/engine/transition.rb +90 -0
- data/lib/sashite/ggn/piece/source/destination/engine.rb +407 -0
- data/lib/sashite/ggn/piece/source/destination.rb +65 -0
- data/lib/sashite/ggn/piece/source.rb +71 -0
- data/lib/sashite/ggn/piece.rb +77 -0
- data/lib/sashite/ggn/schema.rb +152 -0
- data/lib/sashite/ggn/validation_error.rb +31 -0
- data/lib/sashite/ggn.rb +317 -5
- data/lib/sashite-ggn.rb +112 -1
- metadata +31 -151
- data/.gitignore +0 -22
- data/.ruby-version +0 -1
- data/.travis.yml +0 -3
- data/Gemfile +0 -2
- data/Rakefile +0 -7
- data/VERSION.semver +0 -1
- data/lib/sashite/ggn/ability.rb +0 -29
- 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.rb +0 -20
- 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/object.rb +0 -28
- data/lib/sashite/ggn/occupied.rb +0 -29
- data/lib/sashite/ggn/pattern.rb +0 -20
- 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/square.rb +0 -29
- data/lib/sashite/ggn/state.rb +0 -26
- data/lib/sashite/ggn/subject.rb +0 -29
- data/lib/sashite/ggn/unsigned_integer.rb +0 -20
- data/lib/sashite/ggn/unsigned_integer_excluding_zero.rb +0 -20
- data/lib/sashite/ggn/verb.rb +0 -33
- data/lib/sashite/ggn/zero.rb +0 -21
- data/sashite-ggn.gemspec +0 -19
- data/test/_test_helper.rb +0 -2
- data/test/test_ggn.rb +0 -552
- data/test/test_ggn_ability.rb +0 -51
- 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.rb +0 -557
- 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_object.rb +0 -33
- data/test/test_ggn_occupied.rb +0 -78
- data/test/test_ggn_pattern.rb +0 -84
- 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_square.rb +0 -25
- data/test/test_ggn_state.rb +0 -24
- data/test/test_ggn_subject.rb +0 -28
- data/test/test_ggn_unsigned_integer.rb +0 -39
- data/test/test_ggn_unsigned_integer_excluding_zero.rb +0 -25
- data/test/test_ggn_verb.rb +0 -27
- data/test/test_ggn_zero.rb +0 -21
@@ -1,21 +0,0 @@
|
|
1
|
-
require_relative '_test_helper'
|
2
|
-
|
3
|
-
describe Sashite::GGN::NegativeInteger do
|
4
|
-
subject { Sashite::GGN::NegativeInteger }
|
5
|
-
|
6
|
-
describe '.load' do
|
7
|
-
before do
|
8
|
-
@ggn_obj = '-42'
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'loads a document from the current io stream' do
|
12
|
-
subject.load(@ggn_obj).must_equal -42
|
13
|
-
end
|
14
|
-
|
15
|
-
describe 'errors' do
|
16
|
-
it 'raises with an unsigned integer' do
|
17
|
-
-> { subject.load '4' }.must_raise ArgumentError
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/test/test_ggn_null.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require_relative '_test_helper'
|
2
|
-
|
3
|
-
describe Sashite::GGN::Null do
|
4
|
-
subject { Sashite::GGN::Null }
|
5
|
-
|
6
|
-
describe '.load' do
|
7
|
-
before do
|
8
|
-
@ggn_obj = '_'
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'loads a document from the current io stream' do
|
12
|
-
subject.load(@ggn_obj).must_equal nil
|
13
|
-
end
|
14
|
-
|
15
|
-
describe 'errors' do
|
16
|
-
it 'raises without null' do
|
17
|
-
-> { subject.load '4' }.must_raise ArgumentError
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/test/test_ggn_object.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require_relative '_test_helper'
|
2
|
-
|
3
|
-
describe Sashite::GGN::Object do
|
4
|
-
subject { Sashite::GGN::Object }
|
5
|
-
|
6
|
-
describe '.load' do
|
7
|
-
before do
|
8
|
-
@ggn_obj = '_@f+all~_@f+all%self'
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'loads a document from the current io stream' do
|
12
|
-
subject.load(@ggn_obj).hash.must_equal({
|
13
|
-
src_square: {
|
14
|
-
:"...attacked?" => nil,
|
15
|
-
:"...occupied!" => false,
|
16
|
-
area: :all
|
17
|
-
},
|
18
|
-
dst_square: {
|
19
|
-
:"...attacked?" => nil,
|
20
|
-
:"...occupied!" => false,
|
21
|
-
area: :all
|
22
|
-
},
|
23
|
-
promotable_into_actors: [:self]
|
24
|
-
}.hash)
|
25
|
-
end
|
26
|
-
|
27
|
-
describe 'errors' do
|
28
|
-
it 'raises without an object' do
|
29
|
-
-> { subject.load 'foo' }.must_raise ArgumentError
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/test/test_ggn_occupied.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
require_relative '_test_helper'
|
2
|
-
|
3
|
-
describe Sashite::GGN::Occupied do
|
4
|
-
subject { Sashite::GGN::Occupied }
|
5
|
-
|
6
|
-
describe '.load' do
|
7
|
-
describe 'a relationship' do
|
8
|
-
before do
|
9
|
-
@ggn_obj = 'an_ally_actor'
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'loads a document from the current io stream' do
|
13
|
-
subject.load(@ggn_obj).must_equal :an_ally_actor
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'errors' do
|
17
|
-
it 'raises without a relationship' do
|
18
|
-
-> { subject.load 'foobar' }.must_raise ArgumentError
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe 'a boolean' do
|
24
|
-
before do
|
25
|
-
@ggn_obj = 'f'
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'loads a document from the current io stream' do
|
29
|
-
subject.load(@ggn_obj).must_equal false
|
30
|
-
end
|
31
|
-
|
32
|
-
describe 'errors' do
|
33
|
-
it 'raises without a boolean' do
|
34
|
-
-> { subject.load 'foobar' }.must_raise ArgumentError
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'null' do
|
40
|
-
before do
|
41
|
-
@ggn_obj = '_'
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'loads a document from the current io stream' do
|
45
|
-
subject.load(@ggn_obj).must_equal nil
|
46
|
-
end
|
47
|
-
|
48
|
-
describe 'errors' do
|
49
|
-
it 'raises without null' do
|
50
|
-
-> { subject.load '' }.must_raise ArgumentError
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe 'a subject' do
|
56
|
-
before do
|
57
|
-
@ggn_obj = 'f<self>_&_'
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'loads a document from the current io stream' do
|
61
|
-
subject.load(@ggn_obj).hash.must_equal({
|
62
|
-
:"...ally?" => false,
|
63
|
-
actor: :self,
|
64
|
-
state: {
|
65
|
-
:"...last_moved_actor?" => nil,
|
66
|
-
:"...previous_moves_counter" => nil
|
67
|
-
}
|
68
|
-
}.hash)
|
69
|
-
end
|
70
|
-
|
71
|
-
describe 'errors' do
|
72
|
-
it 'raises without a well-formed subject' do
|
73
|
-
-> { subject.load 'f<foo>_&_' }.must_raise ArgumentError
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
data/test/test_ggn_pattern.rb
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
require_relative '_test_helper'
|
2
|
-
|
3
|
-
describe Sashite::GGN::Pattern do
|
4
|
-
subject { Sashite::GGN::Pattern }
|
5
|
-
|
6
|
-
describe '.load' do
|
7
|
-
before do
|
8
|
-
@ggn_obj = 't<self>_&_^shift[-1,0]_/t=_@f+all~_@f+all%self; ' +
|
9
|
-
't<self>_&_^remove[-1,0]1/t=_@f+all~_@an_enemy_actor+all%self'
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'loads a document from the current io stream' do
|
13
|
-
subject.load(@ggn_obj).hash.must_equal(
|
14
|
-
[
|
15
|
-
{
|
16
|
-
:"subject" => {
|
17
|
-
:"...ally?" => true,
|
18
|
-
:"actor" => :self,
|
19
|
-
:"state" => {
|
20
|
-
:"...last_moved_actor?" => nil,
|
21
|
-
:"...previous_moves_counter" => nil
|
22
|
-
}
|
23
|
-
},
|
24
|
-
|
25
|
-
:"verb" => {
|
26
|
-
:"name" => :shift,
|
27
|
-
:"vector" => {:"...maximum_magnitude" => nil, :direction => [-1,0]}
|
28
|
-
},
|
29
|
-
|
30
|
-
:"object" => {
|
31
|
-
:"src_square" => {
|
32
|
-
:"...attacked?" => nil,
|
33
|
-
:"...occupied!" => false,
|
34
|
-
:"area" => :all
|
35
|
-
},
|
36
|
-
:"dst_square" => {
|
37
|
-
:"...attacked?" => nil,
|
38
|
-
:"...occupied!" => false,
|
39
|
-
:"area" => :all
|
40
|
-
},
|
41
|
-
:"promotable_into_actors" => [:self]
|
42
|
-
}
|
43
|
-
},
|
44
|
-
{
|
45
|
-
:"subject" => {
|
46
|
-
:"...ally?" => true,
|
47
|
-
:"actor" => :self,
|
48
|
-
:"state" => {
|
49
|
-
:"...last_moved_actor?" => nil,
|
50
|
-
:"...previous_moves_counter" => nil
|
51
|
-
}
|
52
|
-
},
|
53
|
-
|
54
|
-
:"verb" => {
|
55
|
-
:"name" => :remove,
|
56
|
-
:"vector" => {:"...maximum_magnitude" => 1, :direction => [-1,0]}
|
57
|
-
},
|
58
|
-
|
59
|
-
:"object" => {
|
60
|
-
:"src_square" => {
|
61
|
-
:"...attacked?" => nil,
|
62
|
-
:"...occupied!" => false,
|
63
|
-
:"area" => :all
|
64
|
-
},
|
65
|
-
:"dst_square" => {
|
66
|
-
:"...attacked?" => nil,
|
67
|
-
:"...occupied!" => :an_enemy_actor,
|
68
|
-
:"area" => :all
|
69
|
-
},
|
70
|
-
:"promotable_into_actors" => [:self]
|
71
|
-
}
|
72
|
-
}
|
73
|
-
].hash
|
74
|
-
)
|
75
|
-
end
|
76
|
-
|
77
|
-
describe 'errors' do
|
78
|
-
it 'raises with several identical patterns' do
|
79
|
-
-> { subject.load 't<self>_&_^shift[-1,0]_/t=_@f+all~_@f+all%self; ' +
|
80
|
-
't<self>_&_^shift[-1,0]_/t=_@f+all~_@f+all%self' }.must_raise ArgumentError
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require_relative '_test_helper'
|
2
|
-
|
3
|
-
describe Sashite::GGN::PreviousMovesCounter do
|
4
|
-
subject { Sashite::GGN::PreviousMovesCounter }
|
5
|
-
|
6
|
-
describe '.load' do
|
7
|
-
describe 'null' do
|
8
|
-
before do
|
9
|
-
@ggn_obj = '_'
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'loads a document from the current io stream' do
|
13
|
-
subject.load(@ggn_obj).must_equal nil
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'errors' do
|
17
|
-
it 'raises without null' do
|
18
|
-
-> { subject.load '' }.must_raise ArgumentError
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe 'an unsigned integer' do
|
24
|
-
before do
|
25
|
-
@ggn_obj = '0'
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'loads a document from the current io stream' do
|
29
|
-
subject.load(@ggn_obj).must_equal 0
|
30
|
-
end
|
31
|
-
|
32
|
-
describe 'errors' do
|
33
|
-
it 'raises with a negative integer' do
|
34
|
-
-> { subject.load '-4' }.must_raise ArgumentError
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|