olinox14 / xdice Goto Github PK
View Code? Open in Web Editor NEWThe swiss knife for Dice roll : Command line, API, advanced dice notation parser, compilable patterns...etc.
License: GNU General Public License v3.0
The swiss knife for Dice roll : Command line, API, advanced dice notation parser, compilable patterns...etc.
License: GNU General Public License v3.0
I don't know exactly the cause, but I was tinkering with the package and going through your documented examples and ran across the following failure. I suspect it's due to using latest Python release if I had to guess, but I haven't dug into it any deeper than this.
λ python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xdice
>>> ps = xdice.roll("2d6+18")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files (x86)\Python38-32\lib\site-packages\xdice.py", line 27, in roll
return Pattern(pattern_string).roll()
File "C:\Program Files (x86)\Python38-32\lib\site-packages\xdice.py", line 318, in roll
return PatternScore(self.format_string, scores)
File "C:\Program Files (x86)\Python38-32\lib\site-packages\xdice.py", line 339, in __new__
ps = super(PatternScore, cls).__new__(cls, _secured_eval(eval_string.format(*scores)))
File "C:\Program Files (x86)\Python38-32\lib\site-packages\xdice.py", line 40, in _secured_eval
return eval(raw, {"__builtins__":None}, _ALLOWED)
File "<string>", line 1
<Score; score=10; detail=[5, 5]; dropped=[]; name=2d6>+18
^
SyntaxError: invalid syntax
>>>
Hey can you do this, please? :P
I would almost totally use your system then, because that dice pip package is so bad.
I mean something like
(f - fudge)
"1f10"
possible result: -10 to 10, i.e 7 0 2 -2 -6 10
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.