Documentation
¶
Overview ¶
Package diceprob - Calculating outcome distributions and probabilities for complicated dice expressions.
Index ¶
- type Atom
- type DiceProb
- func (d *DiceProb) Bounds() *[]int64
- func (d *DiceProb) Calculate()
- func (d *DiceProb) Distribution() *map[int64]int64
- func (d *DiceProb) Expression() string
- func (d *DiceProb) Max() int64
- func (d *DiceProb) Min() int64
- func (d *DiceProb) Outcomes() *[]int64
- func (d *DiceProb) OutcomesString() *[]string
- func (d *DiceProb) ParsedExpression() *Expression
- func (d *DiceProb) Permutations() int64
- func (d *DiceProb) Probabilities() *map[int64]float64
- func (d *DiceProb) Roll() int64
- type DiceRoll
- type Expression
- type OpAtom
- type OpTerm
- type Operator
- type Term
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Atom ¶
type Atom struct { Modifier *int64 `parser:"@Modifier"` RollExpr *DiceRoll `parser:"| @DiceRoll"` SubExpression *Expression `parser:"| '(' @@ ')'"` }
Atom - Smallest unit of an expression.
type DiceProb ¶
type DiceProb struct {
// contains filtered or unexported fields
}
DiceProb - Base data structure.
func (*DiceProb) Bounds ¶
Bounds - Range min to max of outcome values for the expression's distribution.
func (*DiceProb) Calculate ¶
func (d *DiceProb) Calculate()
Calculate - Calculate the Distribution and Probabilities for the ParsedExpression.
func (*DiceProb) Distribution ¶
Distribution - Distribution of summed outcomes and their frequency.
func (*DiceProb) Expression ¶
Expression - Return the original expression for the instance.
func (*DiceProb) OutcomesString ¶ added in v0.1.3
OutcomesString - Return list of outcomes for the expression as strings.
func (*DiceProb) ParsedExpression ¶
func (d *DiceProb) ParsedExpression() *Expression
ParsedExpression - Return the parsed expression for the instance.
func (*DiceProb) Permutations ¶ added in v0.1.3
Permutations - Total outcomes for the expression.
func (*DiceProb) Probabilities ¶
Probabilities - Probability of each outcome.
type Expression ¶
Expression - Top level parsing unit.
func (*Expression) Distribution ¶
func (e *Expression) Distribution() *map[int64]int64
Distribution - Determine the outcomes' distribution for the Expression; top-level of the recursive distribution functions.
func (*Expression) Roll ¶
func (e *Expression) Roll() int64
Roll - Roll a random value for the Expression; top-level of the recursive roll functions.
func (*Expression) String ¶
func (e *Expression) String() string
String - Output the dice Expression as a string; top level of recursive output functions.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
dizeprob
dizeprob - Calculate and display probabilities for a given dice expression.
|
dizeprob - Calculate and display probabilities for a given dice expression. |
dizeroll
dizeroll - "Roll" a given dice expression and display the outcome.
|
dizeroll - "Roll" a given dice expression and display the outcome. |