games_dice 0.3.9 → 0.4.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 +7 -0
- data/.rubocop.yml +15 -0
- data/.travis.yml +9 -12
- data/CHANGELOG.md +29 -13
- data/Gemfile +2 -0
- data/README.md +5 -5
- data/Rakefile +14 -11
- data/ext/games_dice/extconf.rb +4 -22
- data/ext/games_dice/probabilities.c +1 -1
- data/games_dice.gemspec +26 -28
- data/lib/games_dice/bunch.rb +241 -247
- data/lib/games_dice/complex_die.rb +287 -303
- data/lib/games_dice/complex_die_helpers.rb +68 -0
- data/lib/games_dice/constants.rb +10 -10
- data/lib/games_dice/dice.rb +146 -143
- data/lib/games_dice/die.rb +101 -97
- data/lib/games_dice/die_result.rb +193 -189
- data/lib/games_dice/map_rule.rb +72 -70
- data/lib/games_dice/marshal.rb +18 -13
- data/lib/games_dice/parser.rb +219 -218
- data/lib/games_dice/reroll_rule.rb +76 -77
- data/lib/games_dice/version.rb +3 -1
- data/lib/games_dice.rb +19 -16
- data/spec/bunch_spec.rb +399 -421
- data/spec/complex_die_spec.rb +314 -306
- data/spec/dice_spec.rb +33 -34
- data/spec/die_result_spec.rb +163 -170
- data/spec/die_spec.rb +81 -82
- data/spec/helpers.rb +26 -22
- data/spec/map_rule_spec.rb +40 -44
- data/spec/parser_spec.rb +106 -82
- data/spec/probability_spec.rb +530 -527
- data/spec/readme_spec.rb +404 -384
- data/spec/reroll_rule_spec.rb +40 -44
- metadata +63 -74
- data/lib/games_dice/probabilities.rb +0 -445
data/lib/games_dice/parser.rb
CHANGED
@@ -1,218 +1,219 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
#
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
out_hash
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
out_hash[:
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
out_hash[:rerolls]
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
out_hash[:keep_mode]
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
out_hash[:maps] <<
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'parslet'
|
4
|
+
|
5
|
+
module GamesDice
|
6
|
+
# Based on the parslet gem, this class defines the dice mini-language used by GamesDice.create
|
7
|
+
#
|
8
|
+
# An instance of this class is a parser for the language. There are no user-definable instance
|
9
|
+
# variables.
|
10
|
+
#
|
11
|
+
class Parser < Parslet::Parser
|
12
|
+
# Parslet rules that define the dice string grammar.
|
13
|
+
rule(:integer) { match('[0-9]').repeat(1) }
|
14
|
+
rule(:plus_minus_integer) { (match('[+-]') >> integer) | integer }
|
15
|
+
rule(:range) { integer.as(:range_start) >> str('..') >> integer.as(:range_end) }
|
16
|
+
rule(:dlabel) { match('[d]') }
|
17
|
+
rule(:space) { match('\s').repeat(1) }
|
18
|
+
rule(:space?) { space.maybe }
|
19
|
+
rule(:underscore) { str('_').repeat(1) }
|
20
|
+
rule(:underscore?) { space.maybe }
|
21
|
+
|
22
|
+
rule(:bunch_start) { integer.as(:ndice) >> dlabel >> integer.as(:sides) }
|
23
|
+
|
24
|
+
rule(:reroll_label) { match(['r']).as(:reroll) }
|
25
|
+
rule(:keep_label) { match(['k']).as(:keep) }
|
26
|
+
rule(:map_label) { match(['m']).as(:map) }
|
27
|
+
rule(:alias_label) { match(['x']).as(:alias) }
|
28
|
+
|
29
|
+
rule(:single_modifier) { alias_label }
|
30
|
+
rule(:modifier_label) { reroll_label | keep_label | map_label }
|
31
|
+
rule(:simple_modifier) { modifier_label >> integer.as(:simple_value) }
|
32
|
+
rule(:comparison_op) { str('>=') | str('<=') | str('==') | str('>') | str('<') }
|
33
|
+
rule(:ctl_string) { match('[a-z_]').repeat(1) }
|
34
|
+
rule(:output_string) { match('[A-Za-z0-9_]').repeat(1) }
|
35
|
+
|
36
|
+
rule(:opint_or_int) { (comparison_op.as(:comparison) >> integer.as(:compare_num)) | integer.as(:compare_num) }
|
37
|
+
rule(:comma) { str(',') }
|
38
|
+
rule(:stop) { str('.') }
|
39
|
+
|
40
|
+
rule(:condition_only) { opint_or_int.as(:condition) }
|
41
|
+
rule(:num_only) { integer.as(:num) }
|
42
|
+
|
43
|
+
rule(:condition_and_type) { opint_or_int.as(:condition) >> comma >> ctl_string.as(:type) }
|
44
|
+
rule(:condition_and_num) { opint_or_int.as(:condition) >> comma >> plus_minus_integer.as(:num) }
|
45
|
+
|
46
|
+
rule(:condition_type_and_num) do
|
47
|
+
opint_or_int.as(:condition) >> comma >> ctl_string.as(:type) >> comma >> integer.as(:num)
|
48
|
+
end
|
49
|
+
rule(:condition_num_and_output) do
|
50
|
+
opint_or_int.as(:condition) >> comma >> plus_minus_integer.as(:num) >> comma >> output_string.as(:output)
|
51
|
+
end
|
52
|
+
rule(:num_and_type) { integer.as(:num) >> comma >> ctl_string.as(:type) }
|
53
|
+
|
54
|
+
rule(:reroll_params) { condition_type_and_num | condition_and_type | condition_only }
|
55
|
+
rule(:map_params) { condition_num_and_output | condition_and_num | condition_only }
|
56
|
+
rule(:keeper_params) { num_and_type | num_only }
|
57
|
+
|
58
|
+
rule(:full_reroll) { reroll_label >> str(':') >> reroll_params >> stop }
|
59
|
+
rule(:full_map) { map_label >> str(':') >> map_params >> stop }
|
60
|
+
rule(:full_keepers) { keep_label >> str(':') >> keeper_params >> stop }
|
61
|
+
|
62
|
+
rule(:complex_modifier) { full_reroll | full_map | full_keepers }
|
63
|
+
|
64
|
+
rule(:bunch_modifier) { complex_modifier | (single_modifier >> stop.maybe) | (simple_modifier >> stop.maybe) }
|
65
|
+
rule(:bunch) { bunch_start >> bunch_modifier.repeat.as(:mods) }
|
66
|
+
|
67
|
+
rule(:operator) { match('[+-]').as(:op) >> space? }
|
68
|
+
rule(:add_bunch) { operator >> bunch >> space? }
|
69
|
+
rule(:add_constant) { operator >> integer.as(:constant) >> space? }
|
70
|
+
rule(:dice_expression) { add_bunch | add_constant }
|
71
|
+
rule(:expressions) { dice_expression.repeat.as(:bunches) }
|
72
|
+
root :expressions
|
73
|
+
|
74
|
+
# Parses a string description in the dice mini-language, and returns data for feeding into
|
75
|
+
# GamesDice::Dice constructor.
|
76
|
+
# @param [String] dice_description Text to parse e.g. '1d6'
|
77
|
+
# @return [Hash] Analysis of dice_description
|
78
|
+
def parse(dice_description)
|
79
|
+
dice_description = dice_description.to_s.strip
|
80
|
+
# Force first item to start '+' for simpler parse rules
|
81
|
+
dice_description = "+#{dice_description}" unless dice_description =~ /\A[+-]/
|
82
|
+
dice_expressions = super(dice_description)
|
83
|
+
{ bunches: collect_bunches(dice_expressions), offset: collect_offset(dice_expressions) }
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def collect_bunches(dice_expressions)
|
89
|
+
dice_expressions[:bunches].select { |h| h[:ndice] }.map do |in_hash|
|
90
|
+
out_hash = {}
|
91
|
+
# Convert integers
|
92
|
+
%i[ndice sides].each do |s|
|
93
|
+
next unless in_hash[s]
|
94
|
+
|
95
|
+
out_hash[s] = in_hash[s].to_i
|
96
|
+
end
|
97
|
+
|
98
|
+
# Multiplier
|
99
|
+
if in_hash[:op]
|
100
|
+
optype = in_hash[:op].to_s
|
101
|
+
out_hash[:multiplier] = case optype
|
102
|
+
when '+' then 1
|
103
|
+
when '-' then -1
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# Modifiers
|
108
|
+
in_hash[:mods]&.each do |mod|
|
109
|
+
if mod[:alias]
|
110
|
+
collect_alias_modifier mod, out_hash
|
111
|
+
elsif mod[:keep]
|
112
|
+
collect_keeper_rule mod, out_hash
|
113
|
+
elsif mod[:map]
|
114
|
+
out_hash[:maps] ||= []
|
115
|
+
collect_map_rule mod, out_hash
|
116
|
+
elsif mod[:reroll]
|
117
|
+
out_hash[:rerolls] ||= []
|
118
|
+
collect_reroll_rule mod, out_hash
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
out_hash
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def collect_offset(dice_expressions)
|
127
|
+
dice_expressions[:bunches].select { |h| h[:constant] }.inject(0) do |total, in_hash|
|
128
|
+
c = in_hash[:constant].to_i
|
129
|
+
optype = in_hash[:op].to_s
|
130
|
+
if optype == '+'
|
131
|
+
total += c
|
132
|
+
else
|
133
|
+
total -= c
|
134
|
+
end
|
135
|
+
total
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# Called when we have a single letter convenient alias for common dice adjustments
|
140
|
+
def collect_alias_modifier(alias_mod, out_hash)
|
141
|
+
alias_name = alias_mod[:alias].to_s
|
142
|
+
case alias_name
|
143
|
+
when 'x' # Exploding re-roll
|
144
|
+
out_hash[:rerolls] ||= []
|
145
|
+
out_hash[:rerolls] << [out_hash[:sides], :==, :reroll_add]
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# Called for any parsed reroll rule
|
150
|
+
def collect_reroll_rule(reroll_mod, out_hash)
|
151
|
+
out_hash[:rerolls] ||= []
|
152
|
+
if reroll_mod[:simple_value]
|
153
|
+
out_hash[:rerolls] << [reroll_mod[:simple_value].to_i, :>=, :reroll_replace]
|
154
|
+
return
|
155
|
+
end
|
156
|
+
|
157
|
+
# Typical reroll_mod: {:reroll=>"r"@5, :condition=>{:compare_num=>"10"@7}, :type=>"add"@10}
|
158
|
+
op = get_op_symbol(reroll_mod[:condition][:comparison] || '==')
|
159
|
+
v = reroll_mod[:condition][:compare_num].to_i
|
160
|
+
type = "reroll_#{reroll_mod[:type] || 'replace'}".to_sym
|
161
|
+
|
162
|
+
out_hash[:rerolls] << if reroll_mod[:num]
|
163
|
+
[v, op, type, reroll_mod[:num].to_i]
|
164
|
+
else
|
165
|
+
[v, op, type]
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# Called for any parsed keeper mode
|
170
|
+
def collect_keeper_rule(keeper_mod, out_hash)
|
171
|
+
raise 'Cannot set keepers for a bunch twice' if out_hash[:keep_mode]
|
172
|
+
|
173
|
+
if keeper_mod[:simple_value]
|
174
|
+
out_hash[:keep_mode] = :keep_best
|
175
|
+
out_hash[:keep_number] = keeper_mod[:simple_value].to_i
|
176
|
+
return
|
177
|
+
end
|
178
|
+
|
179
|
+
# Typical keeper_mod: {:keep=>"k"@5, :num=>"1"@7, :type=>"worst"@9}
|
180
|
+
out_hash[:keep_number] = keeper_mod[:num].to_i
|
181
|
+
out_hash[:keep_mode] = "keep_#{keeper_mod[:type] || 'best'}".to_sym
|
182
|
+
end
|
183
|
+
|
184
|
+
# Called for any parsed map mode
|
185
|
+
def collect_map_rule(map_mod, out_hash)
|
186
|
+
out_hash[:maps] ||= []
|
187
|
+
if map_mod[:simple_value]
|
188
|
+
out_hash[:maps] << [map_mod[:simple_value].to_i, :<=, 1]
|
189
|
+
return
|
190
|
+
end
|
191
|
+
|
192
|
+
# Typical map_mod: {:map=>"m"@4, :condition=>{:compare_num=>"5"@6}, :num=>"2"@8, :output=>"Qwerty"@10}
|
193
|
+
op = get_op_symbol(map_mod[:condition][:comparison] || '>=')
|
194
|
+
v = map_mod[:condition][:compare_num].to_i
|
195
|
+
out_val = 1
|
196
|
+
out_val = map_mod[:num].to_i if map_mod[:num]
|
197
|
+
|
198
|
+
out_hash[:maps] << if map_mod[:output]
|
199
|
+
[v, op, out_val, map_mod[:output].to_s]
|
200
|
+
else
|
201
|
+
[v, op, out_val]
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
# The dice description language uses (r).op.x, whilst GamesDice::RerollRule uses x.op.(r), so
|
206
|
+
# as well as converting to a symbol, we must reverse sense of input to constructor
|
207
|
+
OP_CONVERSION = {
|
208
|
+
'==' => :==,
|
209
|
+
'>=' => :<=,
|
210
|
+
'>' => :<,
|
211
|
+
'<' => :>,
|
212
|
+
'<=' => :>=
|
213
|
+
}.freeze
|
214
|
+
|
215
|
+
def get_op_symbol(parsed_op_string)
|
216
|
+
OP_CONVERSION[parsed_op_string.to_s]
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
@@ -1,77 +1,76 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
|
9
|
-
#
|
10
|
-
# rule.
|
11
|
-
# rule.
|
12
|
-
#
|
13
|
-
#
|
14
|
-
# rule
|
15
|
-
|
16
|
-
#
|
17
|
-
# rule.
|
18
|
-
# rule.
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
raise ArgumentError, "Unrecognised reason for a re-roll #{type}"
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
end # class RerollRule
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GamesDice
|
4
|
+
# This class models a variety of game rules that cause dice to be re-rolled.
|
5
|
+
#
|
6
|
+
# An object of the class represents a single rule, such as "re-roll a result of 1
|
7
|
+
# and use the new value".
|
8
|
+
#
|
9
|
+
# @example A rule for "exploding" dice
|
10
|
+
# rule = GamesDice::RerollRule.new( 6, :<=, :reroll_add )
|
11
|
+
# # Test whether the rule applies . . .
|
12
|
+
# rule.applies? 4 # => false
|
13
|
+
# rule.applies? 6 # => true
|
14
|
+
# rule.type # => :reroll_add
|
15
|
+
#
|
16
|
+
# @example A rule for re-rolling and taking best value if first attempt is lower than a threshold
|
17
|
+
# rule = GamesDice::RerollRule.new( 11, :>, :reroll_use_best, 1 )
|
18
|
+
# # Test whether the rule applies . . .
|
19
|
+
# rule.applies? 4 # => true
|
20
|
+
# rule.applies? 14 # => false
|
21
|
+
# rule.type # => :reroll_use_best
|
22
|
+
#
|
23
|
+
class RerollRule
|
24
|
+
# Creates new instance of GamesDice::RerollRule. The rule will be assessed as
|
25
|
+
# trigger_value.send( trigger_op, x )
|
26
|
+
# where x is the Integer value shown on a die.
|
27
|
+
# @param [Integer,Range<Integer>,Object] trigger_value Any object is allowed, but typically an Integer
|
28
|
+
# @param [Symbol] trigger_op A method of trigger_value that takes an Integer param and returns Boolean
|
29
|
+
# @param [Symbol] type The type of reroll
|
30
|
+
# @param [Integer] limit Maximum number of times this rule can be applied to a single die
|
31
|
+
# @return [GamesDice::RerollRule]
|
32
|
+
def initialize(trigger_value, trigger_op, type, limit = 1000)
|
33
|
+
unless trigger_value.respond_to?(trigger_op)
|
34
|
+
raise ArgumentError,
|
35
|
+
"trigger_value #{trigger_value.inspect} cannot respond to trigger_op #{trigger_value.inspect}"
|
36
|
+
end
|
37
|
+
|
38
|
+
raise ArgumentError, "Unrecognised reason for a re-roll #{type}" unless GamesDice::REROLL_TYPES.key?(type)
|
39
|
+
|
40
|
+
@trigger_value = trigger_value
|
41
|
+
@trigger_op = trigger_op
|
42
|
+
@type = type
|
43
|
+
@limit = limit ? Integer(limit) : 1000
|
44
|
+
@limit = 1 if @type == :reroll_subtract
|
45
|
+
end
|
46
|
+
|
47
|
+
# Trigger operation. How the rule is assessed against #trigger_value.
|
48
|
+
# @return [Symbol] Method name to be sent to #trigger_value
|
49
|
+
attr_reader :trigger_op
|
50
|
+
|
51
|
+
# Trigger value. An object that will use #trigger_op to assess a die result for a reroll.
|
52
|
+
# @return [Integer,Range,Object] Object that receives (#trigger_op, die_result)
|
53
|
+
attr_reader :trigger_value
|
54
|
+
|
55
|
+
# The reroll behaviour that this rule triggers.
|
56
|
+
# @return [Symbol] A category for the re-roll, declares how it should be processed
|
57
|
+
# The following values are supported:
|
58
|
+
# +:reroll_add+:: add result of reroll to running total, and ignore :reroll_subtract for this die
|
59
|
+
# +reroll_subtract+:: subtract result of reroll from running total, reverse sense of any further :reroll_add results
|
60
|
+
# +:reroll_replace+:: use the new value in place of existing value for the die
|
61
|
+
# +:reroll_use_best+:: use the new value if it is higher than the existing value
|
62
|
+
# +:reroll_use_worst+:: use the new value if it is higher than the existing value
|
63
|
+
attr_reader :type
|
64
|
+
|
65
|
+
# Maximum to number of times that this rule can be applied to a single die.
|
66
|
+
# @return [Integer] A number of rolls.
|
67
|
+
attr_reader :limit
|
68
|
+
|
69
|
+
# Assesses the rule against a die result value.
|
70
|
+
# @param [Integer] test_value Value that is result of rolling a single die.
|
71
|
+
# @return [Boolean] Whether the rule applies.
|
72
|
+
def applies?(test_value)
|
73
|
+
@trigger_value.send(@trigger_op, test_value) ? true : false
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/games_dice/version.rb
CHANGED