Documentation ¶
Overview ¶
Package qna provides an implementation of rt.Runtime. ( Its name derives from "questions and answers" - because its the thing that talks to the database. )
Index ¶
- type Notifier
- type Options
- type Randomizer
- type Runner
- func (run *Runner) ActivateDomain(domain string) (err error)
- func (run *Runner) Call(name string, aff affine.Affinity, keys []string, vals []rt.Value) (ret rt.Value, err error)
- func (run *Runner) GetField(target, rawField string) (ret rt.Value, err error)
- func (run *Runner) GetKindByName(rawName string) (ret *rt.Kind, err error)
- func (run *Runner) LoadGame(scene string) (ret string, err error)
- func (run *Runner) PluralOf(singular string) (ret string)
- func (run *Runner) PopScope()
- func (run *Runner) PushScope(top rt.Scope)
- func (run *Runner) Random(inclusiveMin, exclusiveMax int) int
- func (run *Runner) ReciprocalsOf(b, rel string) (ret rt.Value, err error)
- func (run *Runner) RelateTo(a, b, rel string) (err error)
- func (run *Runner) RelativesOf(a, rel string) (ret rt.Value, err error)
- func (run *Runner) SaveGame(scene string) (ret string, err error)
- func (run *Runner) SetField(target, rawField string, val rt.Value) (err error)
- func (run *Runner) SetNotifier(n Notifier)
- func (run *Runner) SingularOf(plural string) (ret string)
- type UserValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notifier ¶
type Notifier struct { StartedScene func(domains []string) EndedScene func(domains []string) ChangedState func(noun, aspect, oldState, newState string) ChangedRelative func(a, b, rel string) }
Callbacks to listen for system level changes
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
uses its own cache to preserve values across domain changes
func NewOptions ¶
func NewOptions() Options
func (Options) OptionByName ¶
return an existing option.
type Randomizer ¶
type Randomizer struct {
// contains filtered or unexported fields
}
func RandomizedTime ¶
func RandomizedTime() Randomizer
func SeedRandomizer ¶
func SeedRandomizer(seed1, seed2 uint64) Randomizer
func (*Randomizer) Random ¶
func (r *Randomizer) Random(inclusiveMin, exclusiveMax int) int
type Runner ¶
type Runner struct { writer.Sink // target for game output // contains filtered or unexported fields }
an implementation of rt.Runtime
func NewRuntimeOptions ¶
func (*Runner) ActivateDomain ¶
func (*Runner) Call ¶
func (run *Runner) Call(name string, aff affine.Affinity, keys []string, vals []rt.Value) (ret rt.Value, err error)
note: this is mirrored/mimicked in package testpat note: in order to generate appropriate defaults ( ex. a record of the right type ) can return both a both meaningful value *and* an error
func (*Runner) GetKindByName ¶
func (*Runner) LoadGame ¶
produces undefined results if called in the middle of a turn returns the file that was loaded
func (*Runner) PopScope ¶
func (run *Runner) PopScope()
remove most recently pushed set of variables. ( implements rt.Runtime )
func (*Runner) PushScope ¶
add the passed set of variables to the pool of current variables ( implements rt.Runtime )
func (*Runner) ReciprocalsOf ¶
func (*Runner) RelativesOf ¶
func (*Runner) SaveGame ¶
produces undefined results if called in the middle of a turn returns the saved file name
func (*Runner) SetNotifier ¶
func (*Runner) SingularOf ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package decode unpacks stored programs and values from byte slices
|
Package decode unpacks stored programs and values from byte slices |
Package qdb asks specific questions of the play.db for the package qna runtime.
|
Package qdb asks specific questions of the play.db for the package qna runtime. |