Documentation ¶
Overview ¶
Package dice utilises the standard "nds" notation where n = number of die and s = number of sides; i.e 1d6, 3d10, 8d8 etc in order to create individual sets of a single type of die or bags of mixed collections that can then be manipulated or rolled
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bag ¶
type Bag struct {
// contains filtered or unexported fields
}
Bag is a collection of different types of Dice; i.e [3d20, 2d4, 1d6]
func NewBag ¶
NewBag returns a new Bag object. A bag can be created with a collection of dice specified in string form for convenience. I.e b := NewBag("2d20", "1d6", "8d8"). Returns error if any item in dice is not a valid dice string
func (*Bag) Add ¶
Add puts more dice in the bag, adding to existing sets where possible. Returns error if s is not a valid dice string
func (*Bag) Remove ¶
Remove reduces the number of dice by the specified s string if s exists in the bag. Returns error if s is not a valid dice string
type Dice ¶
type Dice struct {
// contains filtered or unexported fields
}
Dice represents a set of 1 type of dice, i.e: 3d20 OR 2d4 OR 1d6
func NewDice ¶
NewDice takes the common notation "nds" where n is the number of dice and s is the number of sides; i.e 1d6 and returns a new Dice set. Returns error if s is not a valid dice string