RedLSystem:
Filter:
redUniverse/Classes (extension) | Red > redUniverse > additional

RedLSystem
ExtensionExtension

rewrite strings

Description

A simple string rewrite class.

Class Methods

.new

Arguments:

axiom

The starting string / seed.

rules

Should be a dictionary in the form of (character : replacement string).

Instance Methods

.next

Rewrite and go to next generation.

.reset

Reset generation counter to zero and the production to the axiom.

.rules

Change the rules during the game - not recommended.

Arguments:

dict

A dictionary in the form of (character : replacement string).

.asString

Convert nested production array into a single string.

.axiom

Starting string.

.rules

A dictionary in the form of (character : replacement array of characters).

NOTE: There is a difference from the dictionary used for *new and -rules.

.production

The current production as a nested array.

.generation

A counter.

Examples