posita / dyce Goto Github PK
View Code? Open in Web Editor NEWSimple Python tools for exploring dice outcomes and other finite discrete probabilities
Home Page: https://posita.github.io/dyce/
License: Other
Simple Python tools for exploring dice outcomes and other finite discrete probabilities
Home Page: https://posita.github.io/dyce/
License: Other
helpers/draft-release.sh
and docs via commit in GitLab repo to point to gitlab.com/gitlab.io instead of github.com/github.io
grep 2>|/dev/null -il github * */*
for places to lookWhen trying to execute a program that doesn't use a terminal (.pyw extension) os.get_terminal_size()
throws "ValueError: bad file descriptor".
Resolved substituting it with shutil.get_terminal_size()
, if you want to fix it.
Currently, Rollers support relatively low-level operations, the most complicated being selection. That leaves implementing things like "exploding" dice up to library clients. Histograms already support exploding dice through substitution. Rollers should implement an analogous mechanism.
I'm currently working on a project1 for analyzing games at a higher level (e.g. expected outcomes for Warhammer attack sequences), for which I have been using Pierre Denis's lea
package 2 for the low-level probability analysis. I ran across your work3 and am now evaluating whether it's better suited to my use case. In any event, I thought you might also be interested in evaluating lea
as it seems to be an excellent low-level library for discrete probability analysis, although it lacks some amenities like type hints.
This isn't so much an "issue" as "hello, I'm working in a related space, here's what I've found so far." Cheers!
... in the big mypy numeric tower discussion. Really appreciate your input there! I've run across many of the same stumbling blocks in figuring out how to represent things like numeric values, random values, dice modifiers, probability mass functions, and so on. ↩
Here's a contrived example for which dyce
doesn't provide a convenient interface:
Maybe the ability for expand to return an optional coalesce override would work?
from operator import __add__
from dyce import H
from dyce.h import coalesce_replace
def expand(h: H, outcome):
if h == d6:
if outcome == 6:
return d4 # uses default passed to substitute
else:
return outcome, __add__ # overrides coalesce for this phase
elif h == d4:
if outcome == 1:
return d6, lambda: h, __: h + outcome # like coalesce_replace, but adds the outcome from the d4
else:
return outcome, __add__
else:
assert False, f"unrecognized histogram {h}"
H(6).substitute(expand, coalesce_replace, max_depth=4)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.