dice_stats 0.3.2 → 0.3.3

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/Dice_Set.rb +5 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9f6d1a0c998b07b539e685e61268aa6a226d138
4
- data.tar.gz: 4d14abaaeb4367ba9de944faa4f0af38bb54271f
3
+ metadata.gz: 70860c6a4f15edd6d821b8f4833e85f05fa281d4
4
+ data.tar.gz: d5cf22b0c0946ba091d3286cb431220a5c08a9fc
5
5
  SHA512:
6
- metadata.gz: 3d455e7a7290ce64409899f2cde961ee9f0022c45b4b1df28e6f5c66e42c8fcb12803de87c1ba70cd7d1ac963c66b46c2c229ab55765186dee592fc98830a457
7
- data.tar.gz: 46807c1896347316554414e5e34242e2e0b3308c75e2284a9395f4729d365fd22f37d3df2cca76cef4ade8d883ef359a17d6b22e1aad7cba9f03874149965b88
6
+ metadata.gz: 571de77edfe6e8cd0c8eb3ea551f7a7fec037be2b314c31fcbeb0327a6f0431ff9595e28f2cab1ce713258c6b89a97bbb4efb0637d766e79aac8ae70a7cf3358
7
+ data.tar.gz: a8d667e66eb737217d90913530e0f42a7b7b2bb0fd3e365c6cfc2285fbbaf1c66615599b5b95b1b66466d7beaeee57dd862be1b9fc8854bb2efda0be5bf385db
data/lib/Dice_Set.rb CHANGED
@@ -87,7 +87,10 @@ module Dice_Stats
87
87
  dice_faces = sub_string_split[1].to_i
88
88
 
89
89
  calculate_probability = (probability_distribution == nil) && (number_of_dice * dice_faces <= 1000)
90
- @aborted_probability_distribution = true if !calculate_probability
90
+
91
+ if (number_of_dice * dice_faces > 1000)
92
+ @aborted_probability_distribution = true
93
+ end
91
94
 
92
95
  @dice << Dice.new(number_of_dice, dice_faces, calculate_probability)
93
96
  elsif (split_string[i].to_i > 0)
@@ -102,7 +105,7 @@ module Dice_Stats
102
105
  if probability_distribution != nil
103
106
  @probability_distribution = probability_distribution
104
107
  else
105
- if @aborted_probability_distribution || (100_000 < @dice.inject(0) { |m,d| m + (d.sides * d.count) })
108
+ if @aborted_probability_distribution || (100_000 < @dice.inject(1) { |m,d| m * (d.sides * d.count) })
106
109
  @probability_distribution = {}
107
110
  @aborted_probability_distribution = true
108
111
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dice_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Foy