Giter Club home page Giter Club logo

dyce's People

Contributors

posita avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pinkdiamond1

dyce's Issues

Add lea package to the comparison table?

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!

Footnotes

  1. https://github.com/bszonye/bones

  2. https://bitbucket.org/piedenis/lea/src/dev_lea3/

  3. ... 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.

`H.substitute` has no way to change coalesce behaviors during expansion

Here's a contrived example for which dyce doesn't provide a convenient interface:

  1. Start with a total of zero.
  2. Roll a six-sided die. If the face was a six, go to step 3 (i.e., replace with whatever that produces). Otherwise add the face to the total and stop.
  3. Roll a four-sided die. Add the face to the total. If the face was a one, go to step 2. Otherwise stop.

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.