lindenmayer_systems 0.0.5 copy "lindenmayer_systems: ^0.0.5" to clipboard
lindenmayer_systems: ^0.0.5 copied to clipboard

A Dart library to handle generative grammars known as L-Systems (Lindenmayer Systems).

example/example.dart

import 'package:lindenmayer_systems/src/lindenmayer_systems/dol_system/dol_system.dart';
import 'package:lindenmayer_systems/src/production_rules/production_rule.dart';

void main() {
  /// [DolSystem] Examples

  final testDolSystem = DolSystem(
    alphabet: ['A', 'B'],
    axiom: 'AB',
    productionRuleSet: {
      ProductionRule(predecessor: 'A', successor: 'AB'),
      ProductionRule(predecessor: 'B', successor: 'BA'),
    },
  );

  // Expected result is ABBA
  print(testDolSystem.generate(1));

  testDolSystem.generateAsStream(2)
    ..listen(
      // Should print (ABBA, 1) and ('ABBABAAB', 2)
      print,
    );
}
3
likes
140
pub points
0%
popularity

Publisher

unverified uploader

A Dart library to handle generative grammars known as L-Systems (Lindenmayer Systems).

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (LICENSE)

More

Packages that depend on lindenmayer_systems