dicey 0.16.1 → 0.16.2
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 +4 -4
- data/lib/dicey/sum_frequency_calculators/base_calculator.rb +8 -0
- data/lib/dicey/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5926d48370da981038bcc841fda2d3b1ea995d033f02f2373a097be5a510020a
|
4
|
+
data.tar.gz: 1692a73044f83c7fa8889b86f2ad812cb40e1f9faf26feb94522457872544108
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35e956615ff78b7007a7333172181f0c6666f06a5ab61cf2355c7744f1cff92e01fe9f1ad877c62b853bda9789de02d0a9a76ea13404e2e7a9b2711b7dc6c3df
|
7
|
+
data.tar.gz: '0858e35f03ddd80ef754fde0276f33999124040fd499193c5f7eb2fe0c933c1c24677a2ea25e8ceea0259055469dd9076c6def50cde665267eb88386de8d7659'
|
@@ -25,6 +25,10 @@ module Dicey
|
|
25
25
|
# Possible values for +result_type+ argument in {#call}.
|
26
26
|
RESULT_TYPES = %i[frequencies probabilities].freeze
|
27
27
|
|
28
|
+
# Calculate distribution (probability mass function) for the list of dice.
|
29
|
+
#
|
30
|
+
# Returns empty hash for an empty list of dice.
|
31
|
+
#
|
28
32
|
# @param dice [Enumerable<AbstractDie>]
|
29
33
|
# @param result_type [Symbol] one of {RESULT_TYPES}
|
30
34
|
# @param options [Hash{Symbol => Any}] calculator-specific options,
|
@@ -57,11 +61,15 @@ module Dicey
|
|
57
61
|
|
58
62
|
# Heuristic complexity of the calculator, used to determine best calculator.
|
59
63
|
#
|
64
|
+
# Returns 0 for an empty list of dice.
|
65
|
+
#
|
60
66
|
# @see AutoSelector
|
61
67
|
#
|
62
68
|
# @param dice [Enumerable<AbstractDie>]
|
63
69
|
# @return [Integer]
|
64
70
|
def heuristic_complexity(dice)
|
71
|
+
return 0 if dice.empty?
|
72
|
+
|
65
73
|
calculate_heuristic(dice.length, dice.map(&:sides_num).max).to_i
|
66
74
|
end
|
67
75
|
|
data/lib/dicey/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dicey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandr Bulancov
|
@@ -77,9 +77,9 @@ licenses:
|
|
77
77
|
metadata:
|
78
78
|
homepage_uri: https://github.com/trinistr/dicey
|
79
79
|
bug_tracker_uri: https://github.com/trinistr/dicey/issues
|
80
|
-
documentation_uri: https://rubydoc.info/gems/dicey/0.16.
|
81
|
-
source_code_uri: https://github.com/trinistr/dicey/tree/v0.16.
|
82
|
-
changelog_uri: https://github.com/trinistr/dicey/blob/v0.16.
|
80
|
+
documentation_uri: https://rubydoc.info/gems/dicey/0.16.2
|
81
|
+
source_code_uri: https://github.com/trinistr/dicey/tree/v0.16.2
|
82
|
+
changelog_uri: https://github.com/trinistr/dicey/blob/v0.16.2/CHANGELOG.md
|
83
83
|
rubygems_mfa_required: 'true'
|
84
84
|
post_install_message:
|
85
85
|
rdoc_options:
|