l

package
v0.0.0-...-b85697b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package l implements an L-System Currently this is a DOL system: the left-hand side of a production can only be a single letter; and no two productions can have the same left-hand side.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultLexer

func NewDefaultLexer(rules Rules) *lexmachine.Lexer

NewDefaultLexer returns the default lexer

Types

type Rules

type Rules map[string]string

Rules define all the productions

func NewRules

func NewRules() Rules

NewRules create new production rules

func (Rules) Add

func (r Rules) Add(from string, to string)

Add adds a new rule

func (Rules) Get

func (r Rules) Get(key string) (value string, ok bool)

Get returns the value at key, ok = false if value doesn't exist

type System

type System struct {
	// contains filtered or unexported fields
}

System defines an L-System

func NewSystem

func NewSystem(axiom string, rules Rules, lexer *lexmachine.Lexer) *System

NewSystem returns a new system

func (*System) State

func (s *System) State() *list.List

State returns the current state of the system

func (*System) Step

func (s *System) Step(delay time.Duration)

Step applies the rules once

func (*System) String

func (s *System) String() string

String returns state as string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL