lsystems

Crates.iolsystems
lib.rslsystems
version0.2.1
sourcesrc
created_at2016-02-06 00:43:58.996848
updated_at2017-01-21 19:02:06.603283
descriptionA simple library for working with Lindenmayer systems.
homepage
repositoryhttps://gitlab.com/mechaxl/lsystems
max_upload_size
id4092
size47,912
MechaXL (mechaxl)

documentation

README

Introduction

This project aims to provide a simple interface for working with L-systems in the Rust programming language.

Examples

let mut system = LSystem::with_axiom("b");
system.add_rule('a', "ab");
system.add_rule('b', "a");

for step in 0..10 {
    println!("Step #{}: {}", step, system.next().unwrap());
}
let mut system = LSystem::with_axiom("baaaaaaa");
system.add_rule('b', "a");
system.add_context_rule((Some("b"), 'a', None), "b");

assert_eq!(system.next().unwrap(), "baaaaaaa");
assert_eq!(system.next().unwrap(), "abaaaaaa");
assert_eq!(system.next().unwrap(), "aabaaaaa");
assert_eq!(system.next().unwrap(), "aaabaaaa");
assert_eq!(system.next().unwrap(), "aaaabaaa");
assert_eq!(system.next().unwrap(), "aaaaabaa");
assert_eq!(system.next().unwrap(), "aaaaaaba");
assert_eq!(system.next().unwrap(), "aaaaaaab");
assert_eq!(system.next().unwrap(), "aaaaaaaa");
Commit count: 3

cargo fmt