dicetables 4.0.2__tar.gz → 4.0.2.post4__tar.gz

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 (108) hide show
  1. dicetables-4.0.2.post4/.coveragerc +20 -0
  2. dicetables-4.0.2.post4/.github/workflows/lint-and-format-checks.yaml +23 -0
  3. dicetables-4.0.2.post4/.github/workflows/pr-test.yaml +29 -0
  4. dicetables-4.0.2.post4/.github/workflows/pre-release-jobs.yaml +43 -0
  5. dicetables-4.0.2.post4/.github/workflows/release-jobs.yaml +41 -0
  6. dicetables-4.0.2.post4/.gitignore +31 -0
  7. dicetables-4.0.2.post4/.pre-commit-config.yaml +13 -0
  8. dicetables-4.0.2.post4/.readthedocs.yml +29 -0
  9. dicetables-4.0.2.post4/CHANGELOG.md +196 -0
  10. dicetables-4.0.2.post4/LICENSE +21 -0
  11. dicetables-4.0.2.post4/PKG-INFO +236 -0
  12. {dicetables-4.0.2 → dicetables-4.0.2.post4}/README.rst +32 -96
  13. dicetables-4.0.2.post4/dev.requirements.txt +9 -0
  14. dicetables-4.0.2.post4/dicetables/__init__.py +70 -0
  15. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/additiveevents.py +9 -5
  16. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/dicepool_collection.py +9 -9
  17. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/dicerecord.py +16 -8
  18. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/dicetable.py +17 -10
  19. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/dieevents.py +67 -43
  20. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/eventsbases/eventerrors.py +2 -2
  21. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/eventsbases/integerevents.py +12 -6
  22. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/eventsbases/protodie.py +17 -12
  23. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/eventsinfo.py +52 -31
  24. dicetables-4.0.2.post4/dicetables/factory/errorhandler.py +118 -0
  25. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/factory/eventsfactory.py +31 -20
  26. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/factory/factorytools.py +9 -4
  27. dicetables-4.0.2.post4/dicetables/factory/warninghandler.py +58 -0
  28. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/parser.py +6 -17
  29. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/roller.py +0 -2
  30. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/tools/alias_table.py +10 -4
  31. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/tools/dictcombiner.py +38 -34
  32. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/tools/indexedvalues.py +4 -2
  33. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/tools/limit_checker.py +12 -21
  34. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/tools/listtostring.py +3 -3
  35. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/tools/numberforamtter.py +9 -9
  36. dicetables-4.0.2.post4/docs/Makefile +225 -0
  37. dicetables-4.0.2.post4/docs/_static/bar_chart.png +0 -0
  38. dicetables-4.0.2.post4/docs/_static/dice_pool_times.png +0 -0
  39. dicetables-4.0.2.post4/docs/conf.py +343 -0
  40. dicetables-4.0.2.post4/docs/events_info.rst +91 -0
  41. dicetables-4.0.2.post4/docs/implementation_details/errors_and_bugs.rst +234 -0
  42. dicetables-4.0.2.post4/docs/implementation_details/events_objects.rst +73 -0
  43. dicetables-4.0.2.post4/docs/implementation_details/index.rst +34 -0
  44. dicetables-4.0.2.post4/docs/implementation_details/inheritance.rst +101 -0
  45. dicetables-4.0.2.post4/docs/implementation_details/parser.rst +289 -0
  46. dicetables-4.0.2.post4/docs/index.rst +40 -0
  47. dicetables-4.0.2.post4/docs/intro.rst +154 -0
  48. dicetables-4.0.2.post4/docs/requirements.txt +2 -0
  49. dicetables-4.0.2.post4/docs/roller.rst +48 -0
  50. dicetables-4.0.2.post4/docs/the_basics.rst +120 -0
  51. dicetables-4.0.2.post4/docs/the_dice.rst +324 -0
  52. dicetables-4.0.2.post4/docs/the_dicetable.rst +143 -0
  53. dicetables-4.0.2.post4/doctests.py +24 -0
  54. dicetables-4.0.2.post4/pyproject.toml +38 -0
  55. {dicetables-4.0.2 → dicetables-4.0.2.post4}/tests/eventsbases/test_eventserrors.py +10 -10
  56. {dicetables-4.0.2 → dicetables-4.0.2.post4}/tests/eventsbases/test_integerevents.py +36 -22
  57. {dicetables-4.0.2 → dicetables-4.0.2.post4}/tests/eventsbases/test_protodie.py +50 -51
  58. {dicetables-4.0.2 → dicetables-4.0.2.post4}/tests/factory/test_eventsfactory.py +252 -186
  59. dicetables-4.0.2.post4/tests/factory/test_factoryerrorhandler.py +128 -0
  60. {dicetables-4.0.2 → dicetables-4.0.2.post4}/tests/factory/test_factorytools.py +32 -30
  61. dicetables-4.0.2.post4/tests/factory/test_factorywarninghandler.py +190 -0
  62. dicetables-4.0.2.post4/tests/test_additiveevents.py +173 -0
  63. dicetables-4.0.2.post4/tests/test_dicepool.py +76 -0
  64. dicetables-4.0.2.post4/tests/test_dicepool_collection.py +381 -0
  65. dicetables-4.0.2.post4/tests/test_dicerecord.py +207 -0
  66. dicetables-4.0.2.post4/tests/test_dicetable.py +418 -0
  67. dicetables-4.0.2.post4/tests/test_dieevents.py +845 -0
  68. dicetables-4.0.2.post4/tests/test_eventsinfo.py +601 -0
  69. dicetables-4.0.2.post4/tests/test_parser.py +615 -0
  70. dicetables-4.0.2.post4/tests/test_roller.py +178 -0
  71. dicetables-4.0.2.post4/tests/tools/__init__.py +0 -0
  72. {dicetables-4.0.2 → dicetables-4.0.2.post4}/tests/tools/test_alias_table.py +10 -6
  73. {dicetables-4.0.2 → dicetables-4.0.2.post4}/tests/tools/test_dictcombiner.py +114 -66
  74. {dicetables-4.0.2 → dicetables-4.0.2.post4}/tests/tools/test_indexedvalues.py +10 -7
  75. {dicetables-4.0.2 → dicetables-4.0.2.post4}/tests/tools/test_limit_checker.py +11 -36
  76. {dicetables-4.0.2 → dicetables-4.0.2.post4}/tests/tools/test_listtostring.py +21 -16
  77. {dicetables-4.0.2 → dicetables-4.0.2.post4}/tests/tools/test_numberformatter.py +119 -115
  78. {dicetables-4.0.2 → dicetables-4.0.2.post4}/tests/tools/test_orderedcombinations.py +49 -23
  79. dicetables-4.0.2.post4/time_trials/__init__.py +0 -0
  80. dicetables-4.0.2.post4/time_trials/dicepool_times.py +61 -0
  81. dicetables-4.0.2.post4/time_trials/docs_bar_chart.py +24 -0
  82. dicetables-4.0.2.post4/time_trials/flattenedlist_timetrials.py +321 -0
  83. dicetables-4.0.2.post4/time_trials/getbesttime_data.py +211 -0
  84. dicetables-4.0.2.post4/time_trials/indexedvalues_timetrials.py +970 -0
  85. dicetables-4.0.2.post4/time_trials/time_trials.py +142 -0
  86. dicetables-4.0.2.post4/time_trials/welcome_message.txt +18 -0
  87. dicetables-4.0.2/MANIFEST.in +0 -1
  88. dicetables-4.0.2/PKG-INFO +0 -275
  89. dicetables-4.0.2/dicetables/__init__.py +0 -13
  90. dicetables-4.0.2/dicetables/factory/errorhandler.py +0 -112
  91. dicetables-4.0.2/dicetables/factory/warninghandler.py +0 -60
  92. dicetables-4.0.2/dicetables.egg-info/PKG-INFO +0 -275
  93. dicetables-4.0.2/dicetables.egg-info/SOURCES.txt +0 -53
  94. dicetables-4.0.2/dicetables.egg-info/dependency_links.txt +0 -1
  95. dicetables-4.0.2/dicetables.egg-info/not-zip-safe +0 -1
  96. dicetables-4.0.2/dicetables.egg-info/top_level.txt +0 -2
  97. dicetables-4.0.2/setup.cfg +0 -7
  98. dicetables-4.0.2/setup.py +0 -31
  99. dicetables-4.0.2/tests/factory/test_factoryerrorhandler.py +0 -118
  100. dicetables-4.0.2/tests/factory/test_factorywarninghandler.py +0 -172
  101. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/dicepool.py +0 -0
  102. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/eventsbases/__init__.py +0 -0
  103. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/factory/__init__.py +0 -0
  104. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/tools/__init__.py +0 -0
  105. {dicetables-4.0.2 → dicetables-4.0.2.post4}/dicetables/tools/orderedcombinations.py +0 -0
  106. {dicetables-4.0.2/tests/eventsbases → dicetables-4.0.2.post4/tests}/__init__.py +0 -0
  107. {dicetables-4.0.2/tests/factory → dicetables-4.0.2.post4/tests/eventsbases}/__init__.py +0 -0
  108. {dicetables-4.0.2/tests/tools → dicetables-4.0.2.post4/tests/factory}/__init__.py +0 -0
@@ -0,0 +1,20 @@
1
+ [run]
2
+ branch = True
3
+ source = .
4
+ omit =
5
+ tests/*
6
+ .tox/*
7
+ setup.py
8
+ venv/*
9
+ time_trials/*
10
+ doctests.py
11
+
12
+ [report]
13
+ # Regexes for lines to exclude from consideration
14
+ exclude_lines =
15
+ # Have to re-enable the standard pragma
16
+ pragma: no cover
17
+
18
+ # Don't complain if tests don't hit defensive assertion code:
19
+ raise AssertionError
20
+ raise NotImplementedError
@@ -0,0 +1,23 @@
1
+ name: Lint/Format Checks
2
+ on:
3
+ push:
4
+ branches: [ "master" ]
5
+ pull_request:
6
+ types: ["opened", "reopened", "synchronize"]
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - name: Install Python
13
+ uses: actions/setup-python@v5
14
+ with:
15
+ python-version: "3.11"
16
+ - name: Install dependencies
17
+ run: |
18
+ python -m pip install --upgrade pip
19
+ pip install ruff
20
+ - name: Run Ruff
21
+ run: ruff check --output-format=github .
22
+ - name: Check code formatting with Ruff
23
+ run: ruff format --diff
@@ -0,0 +1,29 @@
1
+ name: PR testing
2
+ on:
3
+ push:
4
+ branches: [ "master" ]
5
+ pull_request:
6
+ types: ["opened", "reopened", "synchronize"]
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ python-version: ["3.9", "3.12", "3.13"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - name: Set up Python ${{ matrix.python-version }}
17
+ uses: actions/setup-python@v3
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+ - name: Install dependencies
21
+ run: |
22
+ python -m pip install --upgrade pip
23
+ python -m pip install pytest pytest-cov
24
+ - name: Test with pytest
25
+ run: |
26
+ pytest . --cov=dicetables --cov-report=xml
27
+ python doctests.py
28
+ - name: Coveralls
29
+ uses: coverallsapp/github-action@v2
@@ -0,0 +1,43 @@
1
+ name: Upload Test Python Package
2
+ on:
3
+ release:
4
+ types: [prereleased]
5
+ permissions:
6
+ contents: read
7
+ jobs:
8
+ release-build:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-python@v5
14
+ with:
15
+ python-version: "3.x"
16
+ - name: Build release distributions
17
+ run: |
18
+ python -m pip install build
19
+ python -m build
20
+ - name: Upload distributions
21
+ uses: actions/upload-artifact@v4
22
+ with:
23
+ name: release-dists
24
+ path: dist/
25
+ pypi-publish:
26
+ name: Upload release to Test PyPI
27
+ runs-on: ubuntu-latest
28
+ needs: [release-build]
29
+ environment:
30
+ name: pre-release-pypi
31
+ url: https://test.pypi.org/p/dicetables
32
+ permissions:
33
+ id-token: write
34
+ steps:
35
+ - name: Retrieve release distributions
36
+ uses: actions/download-artifact@v4
37
+ with:
38
+ name: release-dists
39
+ path: dist/
40
+ - name: Publish package distributions to PyPI
41
+ uses: pypa/gh-action-pypi-publish@release/v1
42
+ with:
43
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,41 @@
1
+ name: Upload Python Package
2
+ on:
3
+ release:
4
+ types: [released]
5
+ permissions:
6
+ contents: read
7
+ jobs:
8
+ release-build:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-python@v5
14
+ with:
15
+ python-version: "3.x"
16
+ - name: Build release distributions
17
+ run: |
18
+ python -m pip install build
19
+ python -m build
20
+ - name: Upload distributions
21
+ uses: actions/upload-artifact@v4
22
+ with:
23
+ name: release-dists
24
+ path: dist/
25
+ pypi-publish:
26
+ name: Upload release to PyPI
27
+ runs-on: ubuntu-latest
28
+ needs: [release-build]
29
+ environment:
30
+ name: release-pypi
31
+ url: https://pypi.org/p/dicetables
32
+ permissions:
33
+ id-token: write
34
+ steps:
35
+ - name: Retrieve release distributions
36
+ uses: actions/download-artifact@v4
37
+ with:
38
+ name: release-dists
39
+ path: dist/
40
+ - name: Publish package distributions to PyPI
41
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,31 @@
1
+ # Compiled python modules.
2
+ *.pyc
3
+
4
+ # Setuptools distribution folder.
5
+ /dist/
6
+ /build/
7
+
8
+
9
+ # Python egg metadata, regenerated from source files by setuptools.
10
+ /*.egg-info
11
+ /*.egg
12
+
13
+ # other
14
+ *.npy
15
+ *.spec
16
+ .coverage
17
+ .tox
18
+ .idea
19
+ /time_trials/best_time_data
20
+ /time_trials/i_v_timetrials_data
21
+ !/time_trials/welcome_message.txt
22
+ /docs/make.bat
23
+ /docs/_build
24
+ /_build
25
+ run_sphinx.sh
26
+ venv/
27
+
28
+ # coverage
29
+ htmlcov
30
+ junit
31
+ coverage.xml
@@ -0,0 +1,13 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v2.3.0
4
+ hooks:
5
+ - id: check-yaml
6
+ - id: end-of-file-fixer
7
+ - id: trailing-whitespace
8
+ - repo: https://github.com/astral-sh/ruff-pre-commit
9
+ rev: v0.8.3
10
+ hooks:
11
+ - id: ruff
12
+ args: [ --fix ]
13
+ - id: ruff-format
@@ -0,0 +1,29 @@
1
+ # .readthedocs.yml
2
+ # Read the Docs configuration file
3
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4
+
5
+ # Required
6
+ version: 2
7
+
8
+ # Set the OS, Python version and other tools you might need
9
+ build:
10
+ os: ubuntu-22.04
11
+ tools:
12
+ python: "3.12"
13
+
14
+ # Build documentation in the docs/ directory with Sphinx
15
+ sphinx:
16
+ configuration: docs/conf.py
17
+
18
+ # Build documentation with MkDocs
19
+ #mkdocs:
20
+ # configuration: mkdocs.yml
21
+
22
+ # Optionally build your docs in additional formats such as PDF
23
+ formats:
24
+ - pdf
25
+
26
+ # Optionally set the version of Python and requirements required to build your docs
27
+ python:
28
+ install:
29
+ - requirements: docs/requirements.txt
@@ -0,0 +1,196 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ ### Fixed
13
+
14
+ - readthedocs.org jobs fixed.
15
+ - coveralls now fixed with github actions.
16
+
17
+ ### Changed
18
+
19
+ - updated infrastructure and readme for modern-ness
20
+ - use pre-commit
21
+ - use pyproject.toml
22
+ - run CI/CD with github actions
23
+
24
+ ### Removed
25
+
26
+ - tox.ini
27
+ - travis ci
28
+
29
+ ## [4.0.2] - 2020-12-20
30
+
31
+ This release is missing in Github
32
+
33
+ ### Added
34
+
35
+ ### Fixed
36
+
37
+ fixed bug in Parser. Before `Parser().parse_die("Die(1, 2, 3)")` returned `Die(1)`. Now, it raises a ParserError.
38
+ `Parser().parse_die("ModDie(1, 2, modifier=3")` also raises `ParserError` as does not enough arguments.
39
+
40
+ ### Changed
41
+
42
+ ### Removed
43
+
44
+ ## [4.0.0] - 2020-12-20
45
+
46
+ This release is missing in Github
47
+
48
+ closest release is [4.0.1](https://github.com/eric-s-s/dice-tables/releases/tag/4.0.1)
49
+
50
+ ### Added
51
+
52
+ ### Fixed
53
+
54
+ ### Changed
55
+
56
+ **Breaking change again!**
57
+
58
+ Revamped DicePools and the Parser.
59
+
60
+ #### Dice Pools
61
+
62
+ BestOfDicePool, WorstOfDicePool, UpperMidOfDicePool and LowerMidOfDicePool are now ProtoDie
63
+ wrappers around a DicePool object. :code:`DicePool(Die(6), 4)` is now a non-IntegerEvents
64
+ object. It is immutable and can get passed around to various DicePoolCollection objects which
65
+ are ProtoDie. So now it is:
66
+
67
+ ```pycon
68
+ >>> import dicetables as dt
69
+ >>> pool = dt.DicePool(dt.Die(6), 4)
70
+ >>> best_of = dt.BestOfDicePool(pool=pool, select=3)
71
+ >>> worst_of = dt.BestOfDicePool(pool=pool, select=3)
72
+ >>> super_best_of = dt.BestOfDicePool(pool=pool, select=1)
73
+ ```
74
+
75
+ #### Parser
76
+
77
+ The parser now takes a LimitChecker object. This defaults to a NoOpLimitChecker
78
+ which doesn't check limits and there's a class method to make a parser with a useful
79
+ limit checker that is the same as the old behavior. You can pass in your own limit
80
+ checker provided that it inherits from
81
+ `dicetables.tools.limit_checker.AbstractLimitChecker`.
82
+
83
+ ```pycon
84
+ >>> from dicetables import Parser, Die, LimitsError
85
+ >>> no_limit = Parser()
86
+ >>> Die(1000) == no_limit.parse_die("Die(1000)")
87
+ True
88
+ >>> limited = Parser.with_limits()
89
+ >>> limited.parse_die("Die(1000)")
90
+ Traceback (most recent call last):
91
+ File "<stdin>", line 1, in <module>
92
+ LimitsError: Max die_size: 500
93
+ ```
94
+
95
+ ### Removed
96
+
97
+
98
+ ## [3.0.0](https://github.com/eric-s-s/dice-tables/releases/tag/v3.0.0) - 2020-09-20
99
+
100
+ **Python 2 is no longer supported**
101
+
102
+ ### Added
103
+
104
+ - type hinting
105
+
106
+ ### Fixed
107
+
108
+ ### Changed
109
+
110
+ ### Removed
111
+
112
+ - python2 support
113
+
114
+
115
+ ## [2.6.0](https://github.com/eric-s-s/dice-tables/releases/tag/2.6.0) - 2020-04-04
116
+
117
+ Last stable release that support python2 and python3
118
+
119
+ ### Added
120
+
121
+ - `Roller`
122
+
123
+ ### Fixed
124
+
125
+ ### Changed
126
+
127
+ - [DicePool](http://dice-tables.readthedocs.io/en/stable/the_dice.html#dice-pools)
128
+
129
+ ### Removed
130
+
131
+
132
+ ## [2.5.0]
133
+
134
+ ### Added
135
+
136
+ - `DicePool` die objects:
137
+ - `BestOfDicePool`
138
+ - `WorstOfDicePool`
139
+ - `UpperMidOfDicePool`
140
+ - `LowerMidOfDicePool`
141
+
142
+ ### Fixed
143
+
144
+ ### Changed
145
+
146
+ - `Parser().add_die_size_limit_kwarg` and `Parser().add_explosions_limit_kwarg` are removed. Use
147
+ `Parser().add_limits_kwarg`
148
+ ### Removed
149
+
150
+
151
+ ## [2.4.0]
152
+
153
+ ### Added
154
+
155
+ - added `max_power_for_commaed` option to `EventsCalculations.full_table_string`.
156
+ - added `max_power_for_commaed` and `min_power_for_fixed_pt` to `EventsCalculations.stats_strings`.
157
+
158
+ ### Fixed
159
+
160
+ - fixed error where `parse_die_within_limits` failed when using default values for dice.
161
+ - `Parser` can parse strings with leading and trailing whitespaces.
162
+ - `parse_die_within_limits` now raises `LimitsError`
163
+ -
164
+ ### Changed
165
+
166
+ ### Removed
167
+
168
+
169
+ ## [2.2.0]
170
+
171
+ ### Added
172
+
173
+ - Added `parse_die_within_limits` function to parser. Also added limit values. Changed getters to properties.
174
+ -
175
+ ### Fixed
176
+
177
+ - Improved ExplodingOn speed.
178
+
179
+ ### Changed
180
+
181
+ ### Removed
182
+
183
+
184
+ ## [2.1.0]
185
+
186
+ ### Added
187
+
188
+ - EventsCalculations added functions log10_points and log10_axes
189
+ - New dice: Exploding(other_die, explosions=2), ExplodingOn(other_die, explodes_on, explosions=2)
190
+ - New object: `Parser`. It converts strings to dice objects.
191
+
192
+ ### Fixed
193
+
194
+ ### Changed
195
+
196
+ ### Removed
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Eric Shaw
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.4
2
+ Name: dicetables
3
+ Version: 4.0.2.post4
4
+ Summary: get all combinations for any set of dice
5
+ Project-URL: Homepage, https://allthedice.com
6
+ Project-URL: Documentation, https://dice-tables.readthedocs.io/en/latest
7
+ Project-URL: Repository, https://github.com/eric-s-s/dice-tables.git
8
+ Project-URL: Issues, https://github.com/eric-s-s/dice-tables/issues
9
+ Project-URL: Changelog, https://github.com/eric-s-s/dice-tables/blob/master/CHANGELOG.md
10
+ Author-email: Eric Shaw <shaweric01@gmail.com>
11
+ Maintainer-email: Eric Shaw <shaweric01@gmail.com>
12
+ License: MIT License
13
+
14
+ Copyright (c) 2019 Eric Shaw
15
+
16
+ Permission is hereby granted, free of charge, to any person obtaining a copy
17
+ of this software and associated documentation files (the "Software"), to deal
18
+ in the Software without restriction, including without limitation the rights
19
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
+ copies of the Software, and to permit persons to whom the Software is
21
+ furnished to do so, subject to the following conditions:
22
+
23
+ The above copyright notice and this permission notice shall be included in all
24
+ copies or substantial portions of the Software.
25
+
26
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
+ SOFTWARE.
33
+ License-File: LICENSE
34
+ Classifier: Development Status :: 5 - Production/Stable
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Programming Language :: Python
39
+ Classifier: Programming Language :: Python :: 3
40
+ Classifier: Topic :: Games/Entertainment :: Role-Playing
41
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
42
+ Requires-Python: >=3.7
43
+ Description-Content-Type: text/x-rst
44
+
45
+ .. image:: https://img.shields.io/badge/License-MIT-yellow
46
+ :target: https://opensource.org/license/MIT
47
+
48
+ .. image:: https://img.shields.io/badge/Python-3.9%20%7C%203.12%20%7C%203.13-blue
49
+
50
+ .. image:: https://badge.fury.io/py/dicetables.svg
51
+ :target: https://badge.fury.io/py/dicetables
52
+
53
+ .. image:: https://coveralls.io/repos/github/eric-s-s/dice-tables/badge.svg?branch=master
54
+ :target: https://coveralls.io/github/eric-s-s/dice-tables?branch=master
55
+
56
+ .. image:: https://static.pepy.tech/badge/dicetables
57
+ :target: https://pepy.tech/projects/dicetables
58
+
59
+
60
+
61
+ #################
62
+ dicetables v4.0.2
63
+ #################
64
+
65
+ Calculate the Combinations For Any Set of Dice
66
+ ==============================================
67
+
68
+ Have you ever wondered what the chances were for killing that 25 hp creature
69
+ with your lvl-5 fireball? Of course you have(it's 3.24%. Good luck with that).
70
+ What about if you could use your loaded dice that roll 6 twice as often.
71
+ We've got you covered (still only a 10% chance). Want to make sure
72
+ you'll win a bet on a number spread for DND dice randomly grabbed from a bag?
73
+ No problem("i'll bet you can't roll 150-200 on 7D4, 4D8, 5D12 and 4D20" ...
74
+ because it's a 0.3% chance). Ever wondered what would happen if you flipped a
75
+ coin a thousand times? (Your chance of flipping heads more than 600 times
76
+ is 0.000000009%.)
77
+
78
+ Impress your friends. Wow the gender of your choice -
79
+ with .... DICETABLES!!!
80
+
81
+ Getting Started
82
+ ===============
83
+
84
+ This module has no dependencies and no requirements. So to get started, simply:
85
+
86
+ .. code-block:: bash
87
+
88
+ $ pip install dicetables
89
+
90
+ or:
91
+
92
+ .. code-block:: bash
93
+
94
+ $ git clone https://github.com/eric-s-s/dice-tables.git
95
+ $ cd dice-tables
96
+ $ python setup.py install
97
+
98
+ The basic objects to use are DiceTable or DetailedDiceTable, and any of the dice classes. They are:
99
+
100
+ - Die
101
+ - ModDie
102
+ - WeightedDie
103
+ - ModWeightedDie
104
+ - Modifier
105
+ - StrongDie
106
+ - Exploding
107
+ - ExplodingOn
108
+ - BestOfDicePool
109
+ - WorstOfDicePool
110
+ - UpperMidOfDicePool
111
+ - LowerMidOfDicePool
112
+
113
+ for details about the dice, see `The Dice <https://dice-tables.readthedocs.io/en/latest/the_dice.html>`_.
114
+ for details about the dice-tables see
115
+ `DiceTable and DetailedDiceTable <http://dice-tables.readthedocs.io/en/latest/the_dicetable.html>`_
116
+
117
+ These are all immutable objects. When you add dice to a DiceTable, it returns a new object and
118
+ doesn't alter the original. Use the :code:`DiceTable.new()` class method to create an empty DiceTable.
119
+
120
+ >>> import dicetables as dt
121
+ >>> empty = dt.DiceTable.new()
122
+ >>> empty
123
+ <DiceTable containing []>
124
+ >>> empty.add_die(dt.Die(6), times=10)
125
+ <DiceTable containing [10D6]>
126
+ >>> empty
127
+ <DiceTable containing []>
128
+ >>> table = empty.add_die(dt.Die(4), times=3)
129
+ >>> table = table.add_die(dt.Die(10), times=5)
130
+ >>> table.get_list()
131
+ [(Die(4), 3), (Die(10), 5)]
132
+ >>> print(table.get_dict()) # This is each roll and how many times it occurs.
133
+ {8: 1,
134
+ 9: 8,
135
+ 10: 36,
136
+ 11: 120,
137
+ 12: 327,
138
+ ...
139
+ ...
140
+ 55: 3072,
141
+ 56: 1608,
142
+ 57: 768,
143
+ 58: 327,
144
+ 59: 120,
145
+ 60: 36,
146
+ 61: 8,
147
+ 62: 1}
148
+
149
+ To get more detailed information, use
150
+ `EventsCalculations <http://dice-tables.readthedocs.io/en/latest/events_info.html>`_.
151
+ It can get the mean, stddev, a nice string of the
152
+ combinations, points and axes for graphing, and stats for any set of rolls.
153
+
154
+ >>> calculator = dt.EventsCalculations(table)
155
+ >>> calculator.mean()
156
+ 35.0
157
+ >>> calculator.stddev(decimal_place=8)
158
+ 6.70820393
159
+ >>> calculator.stats_strings(list(range(8, 20)) + [35] + list(range(50, 63)))
160
+ StatsStrings(query_values='8-19, 35, 50-62',
161
+ query_occurrences='515,778',
162
+ total_occurrences='6,400,000',
163
+ one_in_chance='12.41',
164
+ pct_chance='8.059')
165
+ >>> calculator.percentage_points()
166
+ [(8, 1.5624999999999997e-05),
167
+ (9, 0.00012499999999999998),
168
+ (10, 0.0005625),
169
+ ...
170
+ (59, 0.001875),
171
+ (60, 0.0005625),
172
+ (61, 0.00012499999999999998),
173
+ (62, 1.5624999999999997e-05)]
174
+ >>> big_table = dt.DetailedDiceTable.new().add_die(dt.Die(6), 1000)
175
+ >>> print(big_table.calc.full_table_string()) # DetailedDiceTable owns an EventsCalculations
176
+ 1000: 1
177
+ 1001: 1,000
178
+ 1002: 500,500
179
+ 1003: 1.672e+8
180
+ 1004: 4.192e+10
181
+ 1005: 8.417e+12
182
+ ...
183
+ 3513: 1.016e+776
184
+ 3514: 1.012e+776
185
+ 3515: 1.007e+776
186
+ 3516: 1.001e+776
187
+ 3517: 9.957e+775
188
+ 3518: 9.898e+775
189
+ ...
190
+ 5998: 500,500
191
+ 5999: 1,000
192
+ 6000: 1
193
+
194
+ You can now roll events with a `Roller`
195
+
196
+ >>> events = dt.DiceTable.new().add_die(dt.Die(6))
197
+ >>> roller = dt.Roller(events)
198
+ >>> roller.roll() in [1, 2, 3, 4, 5, 6]
199
+ True
200
+
201
+ That should get you started. For details see
202
+ `<http://dice-tables.readthedocs.io/en/latest/>`_
203
+
204
+ and the github repository at `<https://github.com/eric-s-s/dice-tables>`_
205
+
206
+ -----------------
207
+ Local Development
208
+ -----------------
209
+
210
+ If you want to contribute, you'll need to install the dev requirements.
211
+
212
+ .. code-block:: bash
213
+
214
+ $ git clone https://github.com/eric-s-s/dice-tables.git
215
+ $ cd dice-tables
216
+ $ pip install --upgrade pip && pip install -r dev.requirements.txt
217
+ $ pytest . --cov=dicetables
218
+ $ pre-commit install
219
+ $ pre-commit run -a
220
+
221
+ To build the docs:
222
+
223
+ .. code-block:: bash
224
+
225
+ $ sphinx-build -M html docs build
226
+
227
+ and then open ./build/html/index.html in your browser
228
+
229
+ to build a distribution:
230
+
231
+ .. code-block:: bash
232
+
233
+ $ python -m build --sdist
234
+ $ python -m build --wheel
235
+
236
+ and then you can pip install them directly.