justinian / dice Goto Github PK
View Code? Open in Web Editor NEWGolang dice library
License: MIT License
Golang dice library
License: MIT License
MIT? BSD? All rights reseved? Etc...
Given the structure of dice, it looks like it would be rather trivial to set up the ability to use a custom rand. At least for each individual Roller, given they are all already structs. Setting a base/'dice global' one would be a little more tricky.
I would be willing to submit a PR if it would be accepted.
I'm not particular about the name of said function, but I tried to find a simple way to retrieve 'just the total' from a StdResult and saw that there was an exported function Total() int
, which since it's not a part of the interface requires the client to perform a type assertion along the lines of:
result, _, err := Roll("3d8")
if err!= nil { //handle it }
total := result.(StdResult).Total()
This isn't terrible, but for the purposes of when a client really just wants the simple integer result of a roll, it'd be nice to just call result.Int(). The main problem, though, is that while StdResult.Total() and VsResult.Successes() make sense as the 'simple integer' returns from a Result, I'm clueless as to whether that question even makes sense when it comes to EotE, a system I'm not familiar with.
If there's simply no reasonable simple return from EotE or this is an undesired addition, that's fine; otherwise I'm happy to make the necessary changes and send a PR if given some direction as to what kind of return that implementation should provide.
This isn't necessarily an issue so much as an attempt at understanding the code, but why is the RollResult
interface defined with the embedded interface fmt.Stringer
. As far as I know this is functionally equivalent to String() string
in the interface definition, yes?
Anyway, thanks for the library more generally, I was sitting down thinking of some ideas for CLI helper tools for running some RPGs and realized that a first start was a parser/roller for '3d6' style strings, but figured I better check to make sure someone else hadn't done it first before potentially replicating a lot of work!
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.