rachinations 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -16
- data/Gemfile.lock +2 -0
- data/lib/rachinations/domain/diagrams/diagram.rb +46 -14
- data/lib/rachinations/domain/edges/edge.rb +34 -20
- data/lib/rachinations/domain/modules/common/hash_init.rb +2 -1
- data/lib/rachinations/domain/modules/common/invariant.rb +2 -2
- data/lib/rachinations/domain/modules/common/refiners/number_modifiers.rb +22 -0
- data/lib/rachinations/domain/nodes/converter.rb +5 -5
- data/lib/rachinations/domain/nodes/gate.rb +77 -0
- data/lib/rachinations/domain/nodes/node.rb +69 -36
- data/lib/rachinations/domain/nodes/pool.rb +121 -74
- data/lib/rachinations/domain/nodes/resourceful_node.rb +0 -1
- data/lib/rachinations/domain/nodes/sink.rb +3 -0
- data/lib/rachinations/domain/nodes/source.rb +3 -2
- data/lib/rachinations/domain/resource_bag.rb +3 -4
- data/lib/rachinations/dsl/bad_dsl.rb +2 -0
- data/lib/rachinations/dsl/bootstrap.rb +59 -0
- data/lib/rachinations/dsl/diagram_shorthand_methods.rb +107 -0
- data/lib/rachinations/dsl/helpers/parser.rb +170 -0
- data/lib/rachinations/extras/constant_hash.rb +25 -0
- data/lib/rachinations/extras/fifo.rb +25 -19
- data/lib/rachinations/helpers/edge_helper.rb +40 -0
- data/lib/rachinations/utils/string_helper.rb +7 -0
- data/lib/rachinations/version.rb +1 -1
- data/lib/rachinations.rb +13 -5
- data/rachinations.gemspec +3 -2
- data/testing/simulations/modelo1.rb +1 -1
- data/testing/simulations/sequencial.rb +1 -1
- data/testing/simulations/sobonito.rb +1 -1
- data/testing/simulations/sobonitowhile.rb +1 -1
- data/testing/simulations/whatIwish1.rb +2 -2
- data/testing/spec/canon/conditions_spec.rb +3 -4
- data/testing/spec/converter_spec.rb +3 -4
- data/testing/spec/diagram_spec.rb +293 -238
- data/testing/spec/edge_spec.rb +28 -14
- data/testing/spec/gate_spec.rb +34 -0
- data/testing/spec/pool_spec.rb +8 -10
- data/testing/spec/release1/dsl_spec.rb +204 -0
- data/testing/spec/spec_helper.rb +1 -0
- data/testing/spec/xexeo_spec.rb +39 -40
- metadata +30 -8
- data/lib/rachinations/domain/edges/random_edge.rb +0 -4
- data/lib/rachinations/dsl/dsl.rb +0 -63
- data/testing/spec/canon/trigger_spec.rb +0 -128
data/testing/spec/edge_spec.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require_relative 'spec_helper'
|
2
2
|
|
3
|
+
|
3
4
|
describe Edge do
|
4
5
|
|
5
6
|
describe '#initialize' do
|
6
|
-
|
7
|
+
using NumberModifiers
|
7
8
|
it 'can be created' do
|
8
9
|
|
9
10
|
# i only want to test edge methods so I'll use a mock object and stub the method I need
|
@@ -23,6 +24,7 @@ describe Edge do
|
|
23
24
|
expect(edge.label).to eq 1
|
24
25
|
expect(edge.types).to eq []
|
25
26
|
|
27
|
+
|
26
28
|
end
|
27
29
|
|
28
30
|
it 'can be created with types' do
|
@@ -60,6 +62,16 @@ describe Edge do
|
|
60
62
|
|
61
63
|
end
|
62
64
|
|
65
|
+
|
66
|
+
it 'can be assigned a percent label' do
|
67
|
+
|
68
|
+
from = double(:name => 'node1')
|
69
|
+
to = double(:name => 'node2')
|
70
|
+
|
71
|
+
edge = Edge.new name: 'edge1', from: from, to: to, types: [Blue, Red], label: 50.percent
|
72
|
+
|
73
|
+
end
|
74
|
+
|
63
75
|
end
|
64
76
|
|
65
77
|
describe '#test_ping?' do
|
@@ -75,7 +87,7 @@ describe Edge do
|
|
75
87
|
|
76
88
|
edge = Edge.new :name => 'e', :from => from, :to => @to
|
77
89
|
expect(edge).to receive(:strategy).and_return(@strategy)
|
78
|
-
expect(edge.test_ping?(true)).to eq false
|
90
|
+
expect(edge.test_ping?(require_all:true)).to eq false
|
79
91
|
|
80
92
|
end
|
81
93
|
|
@@ -84,7 +96,7 @@ describe Edge do
|
|
84
96
|
|
85
97
|
edge = Edge.new :name => 'e', :from => from, :to => @to, :label => 8
|
86
98
|
expect(edge).to receive(:strategy).and_return(@strategy)
|
87
|
-
expect(edge.test_ping?(true)).to eq false
|
99
|
+
expect(edge.test_ping?(require_all:true)).to eq false
|
88
100
|
end
|
89
101
|
|
90
102
|
it 'is true when the exact number of required resources are available to be moved' do
|
@@ -92,7 +104,7 @@ describe Edge do
|
|
92
104
|
|
93
105
|
edge = Edge.new :name => 'e', :from => from, :to => @to, :label => 8
|
94
106
|
expect(edge).to receive(:strategy).and_return(@strategy)
|
95
|
-
expect(edge.test_ping?(true)).to eq true
|
107
|
+
expect(edge.test_ping?(require_all:true)).to eq true
|
96
108
|
end
|
97
109
|
|
98
110
|
it 'is true when the more resources than required are available to be moved' do
|
@@ -100,7 +112,7 @@ describe Edge do
|
|
100
112
|
|
101
113
|
edge = Edge.new :name => 'e', :from => from, :to => @to, :label => 2
|
102
114
|
expect(edge).to receive(:strategy).and_return(@strategy)
|
103
|
-
expect(edge.test_ping?(true)).to eq true
|
115
|
+
expect(edge.test_ping?(require_all:true)).to eq true
|
104
116
|
end
|
105
117
|
|
106
118
|
end
|
@@ -112,7 +124,7 @@ describe Edge do
|
|
112
124
|
|
113
125
|
edge = Edge.new :name => 'e', :from => from, :to => @to
|
114
126
|
expect(edge).to receive(:strategy).and_return(@strategy)
|
115
|
-
expect(edge.test_ping?(false)).to eq false
|
127
|
+
expect(edge.test_ping?(require_all:false)).to eq false
|
116
128
|
end
|
117
129
|
|
118
130
|
it 'is true if at least one resource is available' do
|
@@ -120,7 +132,7 @@ describe Edge do
|
|
120
132
|
|
121
133
|
edge = Edge.new :name => 'e', :from => from, :to => @to, :label => 8
|
122
134
|
expect(edge).to receive(:strategy).and_return(@strategy)
|
123
|
-
expect(edge.test_ping?(false)).to eq true
|
135
|
+
expect(edge.test_ping?(require_all:false)).to eq true
|
124
136
|
end
|
125
137
|
|
126
138
|
end
|
@@ -222,13 +234,13 @@ describe Edge do
|
|
222
234
|
context 'when edge has label 1' do
|
223
235
|
|
224
236
|
before(:each) do
|
225
|
-
@p1 = instance_double(Node,name:'n', types: [], enabled?: true)
|
226
|
-
@p2 = instance_double(Node,name:'n2', types: [], enabled?: true)
|
237
|
+
@p1 = instance_double(Node, name: 'n', types: [], enabled?: true)
|
238
|
+
@p2 = instance_double(Node, name: 'n2', types: [], enabled?: true)
|
227
239
|
@e = Edge.new name: 'e', from: @p1, to: @p2
|
228
240
|
end
|
229
241
|
it 'sends put_resource! to to_node' do
|
230
242
|
# passing the same parameter it was given by the caller
|
231
|
-
res = instance_double(Token,type:Token)
|
243
|
+
res = instance_double(Token, type: Token)
|
232
244
|
expect(@p2).to receive(:put_resource!)
|
233
245
|
@e.push!(res)
|
234
246
|
|
@@ -241,16 +253,18 @@ describe Edge do
|
|
241
253
|
|
242
254
|
end
|
243
255
|
|
244
|
-
context 'when edge has label greater than 1' do
|
245
256
|
|
246
|
-
|
257
|
+
end
|
247
258
|
|
248
|
-
|
259
|
+
context 'general tests' do
|
249
260
|
|
250
|
-
end
|
251
261
|
|
252
262
|
|
253
263
|
end
|
254
264
|
|
265
|
+
context 'specific features' do
|
266
|
+
|
267
|
+
end
|
268
|
+
|
255
269
|
|
256
270
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Diagrams with gates' do
|
4
|
+
|
5
|
+
context 'general tests' do
|
6
|
+
|
7
|
+
it 'works' do
|
8
|
+
|
9
|
+
d = Diagram.new
|
10
|
+
|
11
|
+
d.add_node! Source, name: 's'
|
12
|
+
d.add_node! Gate, name: 'g'
|
13
|
+
d.add_node! Pool, name: 'p'
|
14
|
+
d.add_edge! Edge, from: 's', to: 'g'
|
15
|
+
d.add_edge! Edge, from: 'g', to: 'p'
|
16
|
+
|
17
|
+
d.run!(5)
|
18
|
+
|
19
|
+
expect(d.get_node('p').resource_count).to eq 5
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'specific features' do
|
26
|
+
|
27
|
+
it 'does not keep resources over turns' do
|
28
|
+
skip
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
end
|
data/testing/spec/pool_spec.rb
CHANGED
@@ -91,31 +91,31 @@ describe Pool do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'raises an error when it is asked about an unsupported type and it is typed' do
|
94
|
-
expect { @typed.resource_count(Mango) }.to raise_error UnsupportedTypeError
|
94
|
+
expect { @typed.resource_count(type:Mango) }.to raise_error UnsupportedTypeError
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'just returns zero if it is untyped and it is asked about a type' do
|
98
|
-
expect(@untyped.resource_count(Mango)).to eq 0
|
98
|
+
expect(@untyped.resource_count(type:Mango)).to eq 0
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'otherwise works with one type param' do
|
102
|
-
expect(@typed.resource_count(Peach)).to eq 10
|
102
|
+
expect(@typed.resource_count(type:Peach)).to eq 10
|
103
103
|
end
|
104
104
|
|
105
105
|
it 'accepts a single block' do
|
106
|
-
expect(@typed.resource_count {
|
107
|
-
expect(@untyped.resource_count {
|
106
|
+
expect(@typed.resource_count(expr: proc{|r| r.is_type? Peach } ) ).to eq 10
|
107
|
+
expect(@untyped.resource_count( expr: proc{true})).to eq 10
|
108
108
|
|
109
109
|
# if user sent a block. he prolly knows what he's doing so no errors.
|
110
|
-
expect(@typed.resource_count {
|
110
|
+
expect(@typed.resource_count(expr: proc{|r| r.is_type? Football })).to eq 0
|
111
111
|
end
|
112
112
|
|
113
113
|
it 'errors if given both a type and a block' do
|
114
|
-
expect { @typed.resource_count(Peach
|
114
|
+
expect { @typed.resource_count(type:Peach,expr: proc{ |r| r.is_type? Mango } )}.to raise_error ArgumentError
|
115
115
|
end
|
116
116
|
|
117
117
|
it 'also errors if some other nonsense is passed' do
|
118
|
-
expect { @typed.resource_count(
|
118
|
+
expect { @typed.resource_count(Object.new) }.to raise_error ArgumentError
|
119
119
|
expect { @untyped.resource_count('Foo') }.to raise_error ArgumentError
|
120
120
|
end
|
121
121
|
|
@@ -204,8 +204,6 @@ describe Pool do
|
|
204
204
|
it 'does not call push! on edge if it cannot provide the needed resource' do
|
205
205
|
expect(@e).to receive(:push_expression).and_return( proc{ true })
|
206
206
|
|
207
|
-
expect(@p).to receive(:remove_resource!).and_raise(RuntimeError)
|
208
|
-
|
209
207
|
expect(@e).not_to receive(:push!)
|
210
208
|
|
211
209
|
@p.trigger!
|
@@ -0,0 +1,204 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe Diagram do
|
4
|
+
|
5
|
+
using NumberModifiers
|
6
|
+
|
7
|
+
context 'diagram tests using the dsl' do
|
8
|
+
|
9
|
+
it 'runs a simple example diagram' do
|
10
|
+
d = diagram do
|
11
|
+
source 's1'
|
12
|
+
pool 'p1', :push_any, :automatic
|
13
|
+
pool 'p2'
|
14
|
+
edge from: 's1', to: 'p1'
|
15
|
+
edge from: 'p1', to: 'p2'
|
16
|
+
end
|
17
|
+
d.run 5
|
18
|
+
|
19
|
+
expect(d.p1.resource_count).to eq 1
|
20
|
+
expect(d.p2.resource_count).to eq 4
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'runs with one pool with no name' do
|
25
|
+
d = diagram do
|
26
|
+
pool
|
27
|
+
end
|
28
|
+
|
29
|
+
d.run! 5
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
it 'runs with one pool with some params' do
|
35
|
+
|
36
|
+
d = diagram do
|
37
|
+
pool 'p', 9, :pull_all
|
38
|
+
pool 'p', 9, :pull_all
|
39
|
+
end
|
40
|
+
|
41
|
+
d.run! 5
|
42
|
+
expect(d.p.resource_count).to eq 9
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'requires valid names for nodes and edges because they might be used as methods' do
|
47
|
+
|
48
|
+
expect {
|
49
|
+
|
50
|
+
d = diagram 'wrong' do
|
51
|
+
pool 'p1'
|
52
|
+
source 's1'
|
53
|
+
pool 'foo bar'
|
54
|
+
source '1ar baz'
|
55
|
+
edge ' foo', from: 'p1', to: 's1'
|
56
|
+
edge 'foo ', from: 'p1', to: 's1'
|
57
|
+
end
|
58
|
+
|
59
|
+
}.to raise_error(BadDSL)
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'runs with conditions' do
|
64
|
+
|
65
|
+
d = diagram 'conditions' do
|
66
|
+
source 's1'
|
67
|
+
pool 'p1'
|
68
|
+
source 's2', condition: lambda { p1.resource_count > 3 }
|
69
|
+
pool 'p2'
|
70
|
+
edge from: 's1', to: 'p1'
|
71
|
+
edge from: 's2', to: 'p2'
|
72
|
+
end
|
73
|
+
|
74
|
+
d.run! 10
|
75
|
+
|
76
|
+
expect(d.p2.resource_count).to eq 6
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'runs with triggers' do
|
81
|
+
|
82
|
+
d = diagram 'triggers' do
|
83
|
+
source 's1'
|
84
|
+
pool 'p1'
|
85
|
+
source 's2', activation: :passive, triggered_by: 'p1'
|
86
|
+
pool 'p2'
|
87
|
+
edge from: 's1', to: 'p1'
|
88
|
+
edge from: 's2', to: 'p2'
|
89
|
+
end
|
90
|
+
|
91
|
+
d.run! 10
|
92
|
+
|
93
|
+
expect(d.p2.resource_count).to eq 10
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'runs with a three-way, default gate using different notations' do
|
98
|
+
|
99
|
+
d = diagram do
|
100
|
+
source 's1'
|
101
|
+
gate 'g1'
|
102
|
+
edge from: 's1', to: 'g1'
|
103
|
+
pool 'p1'
|
104
|
+
pool 'p2'
|
105
|
+
pool 'p3'
|
106
|
+
edge 'e1', 1/3, from: 'g1', to: 'p1'
|
107
|
+
edge 'e1', from: 'g1', to: 'p2', label: 1/3
|
108
|
+
edge 'e1', from: 'g1', to: 'p3', label: 1/3
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
d.run! 20
|
113
|
+
#this gate is conservative - each resource necessarily goes to
|
114
|
+
#either p1, p2 or p3 so the sum must be equal to the total amount
|
115
|
+
#created by the source
|
116
|
+
expect(d.p1.resource_count + d.p2.resource_count + d.p3.resource_count).to eq 20
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'runs a comprehensive example' do
|
121
|
+
|
122
|
+
d = diagram 'stable_state' do
|
123
|
+
source 's1'
|
124
|
+
gate 'g1'
|
125
|
+
pool 'p1'
|
126
|
+
pool 'p2'
|
127
|
+
pool 'p3'
|
128
|
+
sink 'sink1', activation: :automatic, condition: lambda { p1.resource_count > 30 }
|
129
|
+
edge from: 's1', to: 'g1'
|
130
|
+
edge from: 'g1', to: 'p1', label: 2/4
|
131
|
+
edge from: 'g1', to: 'p2', label: 1/4
|
132
|
+
edge from: 'g1', to: 'p3', label: 1/4
|
133
|
+
edge from: 'p2', to: 'sink1'
|
134
|
+
end
|
135
|
+
|
136
|
+
d.run 300
|
137
|
+
|
138
|
+
expect(d.p3.resource_count).to be_within(40).of(d.p1.resource_count / 2)
|
139
|
+
expect(d.p2.resource_count).to be_within(5).of(1)
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'accepts new simpler syntax' do
|
144
|
+
|
145
|
+
d = diagram 'd1' do
|
146
|
+
pool 'p1', 10, :automatic, :push_any
|
147
|
+
pool 'p2'
|
148
|
+
edge from: 'p1', to: 'p2'
|
149
|
+
end
|
150
|
+
|
151
|
+
d.run 5
|
152
|
+
|
153
|
+
expect(d.p1.resource_count).to eq(5)
|
154
|
+
expect(d.p2.resource_count).to eq(5)
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
it 'example using push_all, activators and triggers' do
|
160
|
+
|
161
|
+
d = diagram do
|
162
|
+
pool 'p1'
|
163
|
+
pool 'p2'
|
164
|
+
pool 'p3'
|
165
|
+
source 's2', :automatic
|
166
|
+
pool 'p5'
|
167
|
+
source 's1', :automatic, condition: expr { p5.resource_count > 5 }
|
168
|
+
pool 'p4', :push_all, initial_value: 11, triggered_by: 's1'
|
169
|
+
edge from: 'p4', to: 'p1'
|
170
|
+
edge from: 'p4', to: 'p2'
|
171
|
+
edge from: 'p4', to: 'p3'
|
172
|
+
edge from: 's2', to: 'p5'
|
173
|
+
end
|
174
|
+
|
175
|
+
d.run 10
|
176
|
+
|
177
|
+
expect(d.p5.resource_count).to eq 10
|
178
|
+
|
179
|
+
expect(d.p1.resource_count).to eq 3
|
180
|
+
expect(d.p2.resource_count).to eq 3
|
181
|
+
expect(d.p3.resource_count).to eq 3
|
182
|
+
|
183
|
+
expect(d.p4.resource_count).to eq 2
|
184
|
+
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
# it "forward-referencing of non existing nodes" do
|
189
|
+
#
|
190
|
+
# expect do
|
191
|
+
#
|
192
|
+
# d = diagram do
|
193
|
+
# pool 'p2', initial_value: 7 # this will be triggered 10 times
|
194
|
+
# edge from: 'p2', to: 'p3'
|
195
|
+
# pool 'p3'
|
196
|
+
# end
|
197
|
+
#
|
198
|
+
# end.not_to raise_error
|
199
|
+
#
|
200
|
+
# end
|
201
|
+
|
202
|
+
|
203
|
+
end
|
204
|
+
end
|
data/testing/spec/spec_helper.rb
CHANGED
data/testing/spec/xexeo_spec.rb
CHANGED
@@ -4,16 +4,16 @@ require_relative 'spec_helper'
|
|
4
4
|
|
5
5
|
describe Diagram do
|
6
6
|
|
7
|
+
using DSL::DiagramShorthandMethods
|
8
|
+
|
7
9
|
it "runs modelo1" do
|
8
10
|
|
9
11
|
n=diagram 'test_diagram' do
|
10
|
-
|
11
|
-
|
12
|
-
edge
|
12
|
+
source 'source'
|
13
|
+
pool 'pool1'
|
14
|
+
edge from: 'source', to: 'pool1'
|
13
15
|
end
|
14
16
|
|
15
|
-
d = Diagram.new('one source one pool')
|
16
|
-
|
17
17
|
n.run!(5)
|
18
18
|
|
19
19
|
end
|
@@ -113,13 +113,13 @@ describe Diagram do
|
|
113
113
|
|
114
114
|
it "runs sequencial" do
|
115
115
|
n=diagram 'test_diagram' do
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
edge
|
121
|
-
edge
|
122
|
-
edge
|
116
|
+
pool 'p1', mode: :push_any, activation: :automatic, initial_value: 8
|
117
|
+
pool 'p2', mode: :push_any, activation: :automatic
|
118
|
+
pool 'p3', mode: :push_any, activation: :automatic
|
119
|
+
pool 'p4', mode: :push_any, activation: :automatic
|
120
|
+
edge from: 'p1', to: 'p2'
|
121
|
+
edge from: 'p2', to: 'p3'
|
122
|
+
edge from: 'p3', to: 'p4'
|
123
123
|
end
|
124
124
|
|
125
125
|
n.run!(5)
|
@@ -128,40 +128,39 @@ describe Diagram do
|
|
128
128
|
end
|
129
129
|
|
130
130
|
it "runs sobonito" do
|
131
|
+
|
131
132
|
n=diagram 'test_diagram' do
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
edge
|
137
|
-
edge
|
138
|
-
edge
|
139
|
-
edge
|
140
|
-
edge
|
141
|
-
edge
|
142
|
-
edge
|
143
|
-
edge
|
133
|
+
pool 'p1', mode: :push_any, activation: :automatic, initial_value: 8
|
134
|
+
pool 'p2', mode: :push_any, activation: :automatic
|
135
|
+
pool 'p3', mode: :push_any, activation: :automatic
|
136
|
+
pool 'p4', mode: :push_any, activation: :automatic
|
137
|
+
edge from: 'p1',to: 'p2'
|
138
|
+
edge from: 'p2',to: 'p1'
|
139
|
+
edge from: 'p1',to: 'p3'
|
140
|
+
edge from: 'p3',to: 'p1'
|
141
|
+
edge from: 'p4',to: 'p2'
|
142
|
+
edge from: 'p2',to: 'p4'
|
143
|
+
edge from: 'p4',to: 'p3'
|
144
|
+
edge from: 'p3',to: 'p4'
|
144
145
|
end
|
145
146
|
|
146
|
-
d = Diagram.new('bonitinho')
|
147
|
-
|
148
147
|
n.run!(20)
|
149
148
|
end
|
150
149
|
|
151
150
|
it "runs sobonitowhile" do
|
152
151
|
n=diagram 'test_diagram' do
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
edge
|
158
|
-
edge
|
159
|
-
edge
|
160
|
-
edge
|
161
|
-
edge
|
162
|
-
edge
|
163
|
-
edge
|
164
|
-
edge
|
152
|
+
pool 'p1', mode: :push_any, activation: :automatic, initial_value: 8
|
153
|
+
pool 'p2', mode: :push_any, activation: :automatic
|
154
|
+
pool 'p3', mode: :push_any, activation: :automatic
|
155
|
+
pool 'p4', mode: :push_any, activation: :automatic
|
156
|
+
edge from: 'p1',to: 'p2'
|
157
|
+
edge from: 'p2',to: 'p1'
|
158
|
+
edge from: 'p1',to: 'p3'
|
159
|
+
edge from: 'p3',to: 'p1'
|
160
|
+
edge from: 'p4',to: 'p2'
|
161
|
+
edge from: 'p2',to: 'p4'
|
162
|
+
edge from: 'p4',to: 'p3'
|
163
|
+
edge from: 'p3',to: 'p4'
|
165
164
|
end
|
166
165
|
|
167
166
|
d = Diagram.new('bonitinho')
|
@@ -174,14 +173,14 @@ describe Diagram do
|
|
174
173
|
|
175
174
|
it "runs whatIwish1" do
|
176
175
|
|
177
|
-
skip "
|
176
|
+
skip "Needed features are missing"
|
178
177
|
|
179
178
|
# n=diagram 'test_diagram' do
|
180
179
|
# node 'source', Source
|
181
180
|
# node 'pool1', Pool
|
182
181
|
# edge 'edge1', Edge, 'source', 'pool1'
|
183
182
|
# node 'pool2', Pool,
|
184
|
-
# converter 'c1'
|
183
|
+
# converter 'c1'
|
185
184
|
# node 'e3' , Edge , 'pool2' , 'c1'
|
186
185
|
# trigger 't1' , Trigger , 'pool1' , 'pool2' , { |ExtendedNode p| p.resouces>0 }
|
187
186
|
# end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rachinations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felipe Almeida
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,8 +122,22 @@ dependencies:
|
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.6.11
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: weighted_distribution
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: |-
|
126
|
-
This project provides a Ruby-based
|
140
|
+
This project provides a Ruby-based DiagramShorthandMethods to enable game designers to
|
127
141
|
design and also test tentative game designs and/or prototypes
|
128
142
|
email:
|
129
143
|
- falmeida1988@gmail.com
|
@@ -146,7 +160,6 @@ files:
|
|
146
160
|
- lib/rachinations/domain/diagrams/verbose_diagram.rb
|
147
161
|
- lib/rachinations/domain/edge_collection.rb
|
148
162
|
- lib/rachinations/domain/edges/edge.rb
|
149
|
-
- lib/rachinations/domain/edges/random_edge.rb
|
150
163
|
- lib/rachinations/domain/exceptions/bad_options.rb
|
151
164
|
- lib/rachinations/domain/exceptions/no_elements_found.rb
|
152
165
|
- lib/rachinations/domain/exceptions/no_elements_matching_condition_error.rb
|
@@ -154,6 +167,7 @@ files:
|
|
154
167
|
- lib/rachinations/domain/exceptions/unsupported_type_error.rb
|
155
168
|
- lib/rachinations/domain/modules/common/hash_init.rb
|
156
169
|
- lib/rachinations/domain/modules/common/invariant.rb
|
170
|
+
- lib/rachinations/domain/modules/common/refiners/number_modifiers.rb
|
157
171
|
- lib/rachinations/domain/modules/common/refiners/proc_convenience_methods.rb
|
158
172
|
- lib/rachinations/domain/modules/diagrams/verbose.rb
|
159
173
|
- lib/rachinations/domain/node_collection.rb
|
@@ -170,8 +184,14 @@ files:
|
|
170
184
|
- lib/rachinations/domain/resources/token.rb
|
171
185
|
- lib/rachinations/domain/strategies/strategy.rb
|
172
186
|
- lib/rachinations/domain/strategies/valid_types.rb
|
173
|
-
- lib/rachinations/dsl/
|
187
|
+
- lib/rachinations/dsl/bad_dsl.rb
|
188
|
+
- lib/rachinations/dsl/bootstrap.rb
|
189
|
+
- lib/rachinations/dsl/diagram_shorthand_methods.rb
|
190
|
+
- lib/rachinations/dsl/helpers/parser.rb
|
191
|
+
- lib/rachinations/extras/constant_hash.rb
|
174
192
|
- lib/rachinations/extras/fifo.rb
|
193
|
+
- lib/rachinations/helpers/edge_helper.rb
|
194
|
+
- lib/rachinations/utils/string_helper.rb
|
175
195
|
- lib/rachinations/version.rb
|
176
196
|
- machinations_diagrams/apenas_bonito.xml
|
177
197
|
- machinations_diagrams/behavior_converter.xml
|
@@ -211,18 +231,19 @@ files:
|
|
211
231
|
- testing/spec/canon/conditions_spec.rb
|
212
232
|
- testing/spec/canon/converter_spec.rb
|
213
233
|
- testing/spec/canon/pool_spec.rb
|
214
|
-
- testing/spec/canon/trigger_spec.rb
|
215
234
|
- testing/spec/converter_spec.rb
|
216
235
|
- testing/spec/diagram_spec.rb
|
217
236
|
- testing/spec/edge_spec.rb
|
237
|
+
- testing/spec/gate_spec.rb
|
218
238
|
- testing/spec/hash_init_spec.rb
|
219
239
|
- testing/spec/node_spec.rb
|
220
240
|
- testing/spec/non_deterministic_diagram_spec.rb
|
221
241
|
- testing/spec/pool_spec.rb
|
242
|
+
- testing/spec/release1/dsl_spec.rb
|
222
243
|
- testing/spec/source_spec.rb
|
223
244
|
- testing/spec/spec_helper.rb
|
224
245
|
- testing/spec/xexeo_spec.rb
|
225
|
-
homepage:
|
246
|
+
homepage: https://github.com/queirozfcom/rachinations
|
226
247
|
licenses:
|
227
248
|
- MIT
|
228
249
|
metadata: {}
|
@@ -258,14 +279,15 @@ test_files:
|
|
258
279
|
- testing/spec/canon/conditions_spec.rb
|
259
280
|
- testing/spec/canon/converter_spec.rb
|
260
281
|
- testing/spec/canon/pool_spec.rb
|
261
|
-
- testing/spec/canon/trigger_spec.rb
|
262
282
|
- testing/spec/converter_spec.rb
|
263
283
|
- testing/spec/diagram_spec.rb
|
264
284
|
- testing/spec/edge_spec.rb
|
285
|
+
- testing/spec/gate_spec.rb
|
265
286
|
- testing/spec/hash_init_spec.rb
|
266
287
|
- testing/spec/node_spec.rb
|
267
288
|
- testing/spec/non_deterministic_diagram_spec.rb
|
268
289
|
- testing/spec/pool_spec.rb
|
290
|
+
- testing/spec/release1/dsl_spec.rb
|
269
291
|
- testing/spec/source_spec.rb
|
270
292
|
- testing/spec/spec_helper.rb
|
271
293
|
- testing/spec/xexeo_spec.rb
|