Giter Site home page Giter Site logo

dicebox's People

Contributors

campaul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dicebox's Issues

Support pluggable RNGs

It would be nice if the user could provide an RNG to use. I can see use cases for having at least a bell curve and a crypto RNG, in addition to the built in uniform RNG.

`Best` operation includes `Add`ed constants

When you add a constant to a die object, that constant is effectively treated as a die that can only roll its value (i.e., d(10) + 5 is effectively 2 dice—one which can roll 1..10 and one which can only roll 5).

This interacts with the >> operator in a potentially non-intuitive way:

$ python
Python 2.7.5 (default, Aug 25 2013, 00:04:04) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from dicebox import d
>>> roll = 3 * d(5) + 6
>>> roll()
[1, 3, 5, 6]
>>> (roll >> 2)()
[5, 6]

This can be avoided by properly sequencing operations; the above should really be
((3 * d(5)) >> 2) + 6 instead of (3 * d(5) + 6) >> 2. However, it may be worth making the two Sort operations ignore Adds.

Document decorator API

The operator based API is fun, but it's not as powerful as the decorator based approach used internaly. Note: decorator here is referring to the pattern, not Python decorators.

Support special dice

The d function can be expanded to understand more than just numbers. For example, the user might do something like d('20e') for an exploding d20. This could also be the mechanism for specifying RNGs.

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.