Documentation ¶
Index ¶
- func ParseRules(rulesMap map[Token]string) (TokenSet, TokenSet, map[Token]ProductionRule)
- type Buffer
- type ByteProductionRule
- type ByteWeightedRule
- type LSystem
- func (l *LSystem) AnalyseProductionRates() map[Token]ProductionRate
- func (l *LSystem) DecodeBytes(bp []TokenStateId) []Token
- func (l *LSystem) EncodeTokens(tokens []Token) []TokenStateId
- func (l *LSystem) HandleStatisticsServer(w http.ResponseWriter, _ *http.Request)
- func (l *LSystem) IsConstant(t Token) bool
- func (l *LSystem) IsVariable(t Token) bool
- func (l *LSystem) Iterate(n int) []TokenStateId
- func (l *LSystem) IterateOnce() []TokenStateId
- func (l *LSystem) IterateUntil(n int) []TokenStateId
- func (l *LSystem) Recreate(byteRules [255]ByteProductionRule) *LSystem
- func (l *LSystem) RecreateWithMemPool(byteRules [255]ByteProductionRule, pool *MemPool) *LSystem
- func (l *LSystem) Reset()
- func (l *LSystem) Serve() error
- func (l *LSystem) String() string
- type MemPool
- type ProductionRate
- type ProductionRule
- type Token
- type TokenSet
- type TokenStateId
- type WeightedRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseRules ¶
Types ¶
type Buffer ¶
type Buffer struct { BytePairs []TokenStateId Len int Cap int }
func (*Buffer) Append ¶
func (m *Buffer) Append(bp TokenStateId)
func (*Buffer) AppendSlice ¶
func (m *Buffer) AppendSlice(bps []TokenStateId)
type ByteProductionRule ¶
type ByteProductionRule struct { Weights []ByteWeightedRule PreSampledWeights []uint8 Predecessor TokenStateId // contains filtered or unexported fields }
func (*ByteProductionRule) ChooseSuccessor ¶
func (bp *ByteProductionRule) ChooseSuccessor(l *LSystem, previousToken TokenStateId) []TokenStateId
func (*ByteProductionRule) PreSample ¶
func (bp *ByteProductionRule) PreSample()
func (*ByteProductionRule) RandomizeWeights ¶
func (bp *ByteProductionRule) RandomizeWeights(delta float64, presample bool)
func (*ByteProductionRule) String ¶
func (bp *ByteProductionRule) String(tokens [255]Token) string
type ByteWeightedRule ¶
type ByteWeightedRule struct { LowerLimit float64 UpperLimit float64 Catalyst TokenStateId Successor []TokenStateId }
type LSystem ¶
type LSystem struct { Axiom Token Rules map[Token]ProductionRule Variables TokenSet Constants TokenSet EmptyTokenId TokenStateId TokenBytes map[Token]TokenStateId BytesToken [255]Token ByteRules [255]ByteProductionRule ParamToByte [255]TokenStateId Params [128]uint8 MemPool *MemPool // contains filtered or unexported fields }
func NewLSystem ¶
func (*LSystem) AnalyseProductionRates ¶
func (l *LSystem) AnalyseProductionRates() map[Token]ProductionRate
AnalyseProductionRates analyses the production rate of each production rule by creating a new LSystem for each rule containing only its own rules and itself as axiom. Then it iterates the LSystem for a given number of iterations and analyzing the distribution of the produced tokens.
func (*LSystem) DecodeBytes ¶
func (l *LSystem) DecodeBytes(bp []TokenStateId) []Token
func (*LSystem) EncodeTokens ¶
func (l *LSystem) EncodeTokens(tokens []Token) []TokenStateId
func (*LSystem) HandleStatisticsServer ¶
func (l *LSystem) HandleStatisticsServer(w http.ResponseWriter, _ *http.Request)
func (*LSystem) IsConstant ¶
func (*LSystem) IsVariable ¶
func (*LSystem) Iterate ¶
func (l *LSystem) Iterate(n int) []TokenStateId
func (*LSystem) IterateOnce ¶
func (l *LSystem) IterateOnce() []TokenStateId
func (*LSystem) IterateUntil ¶
func (l *LSystem) IterateUntil(n int) []TokenStateId
func (*LSystem) Recreate ¶
func (l *LSystem) Recreate(byteRules [255]ByteProductionRule) *LSystem
func (*LSystem) RecreateWithMemPool ¶
func (l *LSystem) RecreateWithMemPool(byteRules [255]ByteProductionRule, pool *MemPool) *LSystem
type MemPool ¶
type MemPool struct {
// contains filtered or unexported fields
}
func NewMemPool ¶
func (*MemPool) GetReadBuffer ¶
func (*MemPool) GetWriteBuffer ¶
func (*MemPool) ReadAll ¶
func (m *MemPool) ReadAll() []TokenStateId
type ProductionRate ¶
func (*ProductionRate) RenderChart ¶
func (pr *ProductionRate) RenderChart(w io.Writer) error
type ProductionRule ¶
type ProductionRule struct { Predecessor Token Weights []WeightedRule }
func NewProductionRule ¶
func NewProductionRule(predecessor Token, weights []WeightedRule) ProductionRule
func (*ProductionRule) ChooseSuccessor ¶
func (r *ProductionRule) ChooseSuccessor() []Token
func (*ProductionRule) EncodeTokens ¶
func (r *ProductionRule) EncodeTokens(tokenBytes map[Token]TokenStateId, presample bool) ByteProductionRule
func (*ProductionRule) String ¶
func (r *ProductionRule) String() string
type TokenStateId ¶
type TokenStateId uint8
func NewTokenStateId ¶
func NewTokenStateId(tokenId uint8, hasParam bool) TokenStateId
func (TokenStateId) HasParam ¶
func (bt TokenStateId) HasParam() bool
func (TokenStateId) TokenId ¶
func (bt TokenStateId) TokenId() uint8
type WeightedRule ¶
func ParseRule ¶
func ParseRule(str string) []WeightedRule
Source Files ¶
Click to show internal directories.
Click to hide internal directories.