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 +4 -4
- data/README.md +11 -4
- data/lib/dicey/die_foundry.rb +3 -3
- data/lib/dicey/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 530103d6f251d8f7c0b8400bde5b70c7c92bc6f79c6638aa99e0900f2af2129b
|
|
4
|
+
data.tar.gz: 943e0dd4655eb14c1e8b67bbbdf53deadec26856a864bfa5cb25b7f7d0b624e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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
|
|
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,
|
|
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.
|
data/lib/dicey/die_foundry.rb
CHANGED
|
@@ -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
|
-
|
|
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>#{
|
|
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#{
|
|
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
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.
|
|
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-
|
|
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.
|
|
86
|
-
source_code_uri: https://github.com/trinistr/dicey/tree/v0.17.
|
|
87
|
-
changelog_uri: https://github.com/trinistr/dicey/blob/v0.17.
|
|
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:
|