Documentation ¶
Overview ¶
Package dice is a simple package that defines die components with variable numbers of sides.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DynamicValue ¶
DynamicValue encodes which face is currently selected.
func (*DynamicValue) ReadSetConfigurer ¶
func (d *DynamicValue) ReadSetConfigurer() boardgame.PropertyReadSetConfigurer
ReadSetConfigurer returns an autp-generated boardgame.PropertyReadSetConfigurer for DynamicValue
func (*DynamicValue) ReadSetter ¶
func (d *DynamicValue) ReadSetter() boardgame.PropertyReadSetter
ReadSetter returns an autp-generated boardgame.PropertyReadSetter for DynamicValue
func (*DynamicValue) Reader ¶
func (d *DynamicValue) Reader() boardgame.PropertyReader
Reader returns an autp-generated boardgame.PropertyReader for DynamicValue
func (*DynamicValue) Roll ¶
func (d *DynamicValue) Roll(r *rand.Rand)
Roll sets the Value of the Die randomly to a new value that is legal for the die Value it is associated with. Accepts a source of randomness it will use. You almost always should pass state.Rand() for this to have outcomes that are deterministic for this state (which can be useful for testing scenarios). If r is nil, a generic source of randomness will be used.
type Value ¶
type Value struct { base.ComponentValues Faces []int }
Value is the value component of a dice, encoding what the allowable values are.
func DefaultDie ¶
func DefaultDie() *Value
DefaultDie returns a die configured as as a typical six-sided die.
func (*Value) ReadSetConfigurer ¶
func (v *Value) ReadSetConfigurer() boardgame.PropertyReadSetConfigurer
ReadSetConfigurer returns an autp-generated boardgame.PropertyReadSetConfigurer for Value
func (*Value) ReadSetter ¶
func (v *Value) ReadSetter() boardgame.PropertyReadSetter
ReadSetter returns an autp-generated boardgame.PropertyReadSetter for Value
func (*Value) Reader ¶
func (v *Value) Reader() boardgame.PropertyReader
Reader returns an autp-generated boardgame.PropertyReader for Value