scamp_extensions.process.l_systems.LSystem
- class scamp_extensions.process.l_systems.LSystem(seed_string: str, production_rules: MutableMapping[str, str], meanings: Optional[MutableMapping[str, Any]] = None)[source]
Bases:
object
Simple implementation of an LSystem. Each generation is a string consisting of an alphabet of characters. Optionally, these characters can be assigned meanings.
- Parameters:
seed_string – the initial string
production_rules – dictionary describing how each letter evolves in a subsequent generation. Any letter not found in the dictionary is assumed to be a constant. Also, stochastic rules are possible by providing a list or tuple of outcomes for a given letter, or a list/tuple consisting of a list of outcomes and a list of weightings.
meanings – (optional) dictionary specifying the meaning of each letter. Should contain an entry for every letter potentially encountered.
- Variables:
seed – the initial string
rules – dictionary describing how each letter evolves in a subsequent generation. Any letter not found in the dictionary is assumed to be a constant
meanings – (optional) dictionary specifying the meaning of each letter. Should contain an entry for every letter potentially encountered.
Methods
Get the state of the system at the nth generation of iteration, where n=0 is the initial state.
Get the meanings associated with the given generation, according to the meanings dictionary.