LindenmayerSystem constructor

LindenmayerSystem({
  1. required String axiom,
  2. required List<String> alphabet,
})

An abstract representation of a Lindenmayer System, or L-System.

An L-System is a formal grammar, described by the following triplet:

G = {V, ω, P}

Where V is the system's alphabet, ω is the system's axiom and P is the system's production rule set.

In other words, an L-System is composed of three things:

Because some Lindenmayer System types behave differently when it comes to rules (see DolSystem as an example), they are not present in this abstraction.

Implementation

LindenmayerSystem({
  required this.axiom,
  required this.alphabet,
}) {
  for (var i = 0; i < axiom.length; i++) {
    final symbolToCompare = axiom[i];
    assert(
      alphabet.contains(symbolToCompare),
      '''Axiom can only have symbols from alphabet.
      $symbolToCompare was not found in $alphabet''',
    );
  }
}