TabletopAssistant / DiceKit

Swift framework for expressing and evaluating dice notation (e.g., d20, 4d6+4, 3d8×10+2), which is commonly used in tabletop role-playing games.
Apache License 2.0
14 stars 1 forks source link

Add global convenience function to create Die #35

Closed brentleyjones closed 9 years ago

brentleyjones commented 9 years ago

It's sort of verbose to create dice in long form:

let die = Die(sides: 8)

With expressions it gets even more unwieldy:

let expression = MultiplicationExpression(2, Die(sides: 20))

When #34 is implemented this will be a lot better:

let expression = 2 * Die(sides: 20)

The final improvement would be to make the die creation better:

let expression = 2 * d(20)