dicey 0.17.0 → 0.17.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44c61b75bbf67e966293a7f0f77eb1aef19add3f28989f2a04143fe12fdabfc8
4
- data.tar.gz: 5d9c59008e82a2140ed01432f8e4d1e2dbc0e47e184c0fdc715cf3a77a8f4696
3
+ metadata.gz: 530103d6f251d8f7c0b8400bde5b70c7c92bc6f79c6638aa99e0900f2af2129b
4
+ data.tar.gz: 943e0dd4655eb14c1e8b67bbbdf53deadec26856a864bfa5cb25b7f7d0b624e6
5
5
  SHA512:
6
- metadata.gz: 2e54b27bc49ddb8586684ea4e9a71e5b7ec81b4436ee026c6aa5ab1340c72d92025bbb783bb8d754357c396debfc921e74cf4361fe0d5193c10f5c19f128279f
7
- data.tar.gz: 7ae20ecc547a2a151bad2111b22ca323f68b0d09882b0b808c934551e1d36476fae7c265a549488179fcfb2db64f45cf8924a4306396c44c0eb2f05847710c6b
6
+ metadata.gz: 747b729c073e357d7f4016d40df42a1669d166c1056e91dcf4ad07308a92f6a09c9cc2e058bbf595930766e8319197be529daa5041b280bbb6c98ab1b0f1538f
7
+ data.tar.gz: c2cf10206752a9d0fff536b5d1e13291520d2af4355d468f51288d8f922de3c94dfca3cfefc20d6536c5aa957ec8d7e178724a7bdfabf544aaede4ab49cda8aa
data/README.md CHANGED
@@ -10,7 +10,13 @@
10
10
 
11
11
  The premier solution in total paradigm shift for resolving dicey problems of tomorrow, today, used by industry-leading professionals around the world!
12
12
 
13
- In seriousness, this program is mainly useful for calculating distributions of weights (or probabilities) of all possible dice rolls for a given set of dice. Dice in such a set can be different, have arbitrary numbers, or even be non-numeric altogether. It can also be used to roll any dice that it supports.
13
+ *\*cough, cough\**
14
+
15
+ Dicey is a calculator of weight/probability distributions of all possible dice rolls for a given set of dice, with support for pretty much any dice you can imagine. It can also roll those dice, if you just need a roller!
16
+
17
+ Dicey was created due to frustration with online "calculators" that just calculate a single probability, and not even for interesting combinations of dice. Over time it has grown to support features that I've not seen anywhere else.
18
+
19
+ Check out Dicey online at [dicey.bulancov.tech](https://dicey.bulancov.tech)!
14
20
 
15
21
  ## Table of contents
16
22
 
@@ -42,7 +48,7 @@ In seriousness, this program is mainly useful for calculating distributions of w
42
48
 
43
49
  Use online version of **Dicey** on its own website: [dicey.bulancov.tech](https://dicey.bulancov.tech)!
44
50
 
45
- It does not provide quite all features, but it's easy to use and quick to get started.
51
+ It does not provide quite all features, but it's easy to use and quick to get started. And it's installable as a webapp, so it can be used offline too!
46
52
 
47
53
  ### For those who want the full command line experience
48
54
 
@@ -242,7 +248,7 @@ You have a sudden urge to roll dice while only having boring integer dice at hom
242
248
 
243
249
  Look no further than **roll** mode introduced in **Dicey** 0.12:
244
250
  ```sh
245
- $ dicey 0.5,1.0,1.5,2.0,2.5 4 --mode roll # As always, can be abbreviated to -m r
251
+ $ dicey 1/2,1,1.5,2,2.5 4 --mode roll # As always, can be abbreviated to -m r
246
252
  # (1/2,1,3/2,2,5/2)+D4
247
253
  roll => 7/2 # You probably will get a different value here.
248
254
  ```
@@ -269,8 +275,9 @@ There are four *main* ways to define dice:
269
275
  - *"5", "25", or "525"*: a single positive integer makes a regular die (like a D20).
270
276
  - *"3-6", "-5..5", "(0-1)"*: a pair of integers with a separator, possibly in round brackets, makes a numeric die with integers in the range.
271
277
  - Accepted separators: "-", "..", "...", "–" (en dash), "—" (em dash), "…" (ellipsis).
272
- - *"1,2,4", "(-1.5,0,1.5)", or "2,"*: a list of any numbers separated by commas, possibly in round brackets, makes a custom numeric die.
278
+ - *"1,2,4", "(-1.5,0,3/2)", or "2,"*: a list of any numbers separated by commas, possibly in round brackets, makes a custom numeric die.
273
279
  - Lists can end in a comma, allowing single-number lists.
280
+ - There is no difference between equal decimal and fractional representations of numbers.
274
281
  - *"1,1.5,Two", "(💚,🧡,💙,💜)" or "('1','(bracket)')"*: a list of strings and numbers separated by commas, possibly in round brackets, makes an arbitrary die.
275
282
  - Lists can end in a comma, allowing single-string lists.
276
283
  - Single (') or double (") quotes can be used to include other quotes and round brackets in the string. Otherwise, they are prohibited. Commas are always prohibited.
@@ -16,7 +16,7 @@ module Dicey
16
16
  # Regexp for an integer number.
17
17
  INTEGER = /(?:-?\d++)/
18
18
  # Regexp for a (possibly) fractional number.
19
- DECIMAL = /(?:-?\d++(?:\.\d++)?)/
19
+ FRACTION = %r{(?:-?\d++(?:/\d++|\.\d++)?)}
20
20
  # Regexp for an "arbitrary" string.
21
21
  STRING = /(?:(?<side>[^"',()]++)|"(?<side>[^",]++)"|'(?<side>[^',]++)')/
22
22
 
@@ -31,7 +31,7 @@ module Dicey
31
31
  [/\A#{PREFIX}\(?(?<sides>#{INTEGER}(?:(?:,#{INTEGER})++,?+|,))\)?\z/,
32
32
  :weirdly_shaped_mold].freeze,
33
33
  # Non-integers require special handling for precision.
34
- [/\A#{PREFIX}\(?(?<sides>#{DECIMAL}(?:(?:,#{DECIMAL})++,?+|,))\)?\z/,
34
+ [/\A#{PREFIX}\(?(?<sides>#{FRACTION}(?:(?:,#{FRACTION})++,?+|,))\)?\z/,
35
35
  :weirdly_precise_mold].freeze,
36
36
  # Lists of stuff are broken into AbstractDie.
37
37
  [/\A#{PREFIX}\(?(?<sides>#{STRING}(?:(?:,#{STRING})++,?+|,))\)?\z/, :cursed_mold].freeze,
@@ -97,7 +97,7 @@ module Dicey
97
97
  case side
98
98
  when /\A#{INTEGER}\z/o
99
99
  side.to_i
100
- when /\A#{DECIMAL}\z/o
100
+ when /\A#{FRACTION}\z/o
101
101
  rational_to_integer(Rational(side))
102
102
  else
103
103
  side.match(STRING)[:side].to_sym
data/lib/dicey/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dicey
4
- VERSION = "0.17.0"
4
+ VERSION = "0.17.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dicey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Bulancov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-28 00:00:00.000000000 Z
11
+ date: 2025-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vector_number
@@ -82,9 +82,9 @@ licenses:
82
82
  metadata:
83
83
  homepage_uri: https://github.com/trinistr/dicey
84
84
  bug_tracker_uri: https://github.com/trinistr/dicey/issues
85
- documentation_uri: https://rubydoc.info/gems/dicey/0.17.0
86
- source_code_uri: https://github.com/trinistr/dicey/tree/v0.17.0
87
- changelog_uri: https://github.com/trinistr/dicey/blob/v0.17.0/CHANGELOG.md
85
+ documentation_uri: https://rubydoc.info/gems/dicey/0.17.1
86
+ source_code_uri: https://github.com/trinistr/dicey/tree/v0.17.1
87
+ changelog_uri: https://github.com/trinistr/dicey/blob/v0.17.1/CHANGELOG.md
88
88
  rubygems_mfa_required: 'true'
89
89
  post_install_message:
90
90
  rdoc_options: