Table of Contents

Class LSystem<TSymbol>

Namespace
Gamelogic.Extensions.Algorithms
Assembly
Assembly-CSharp.dll

A lightweight implementation of an L-system.

[Version(1, 4, 1)]
public class LSystem<TSymbol>

Type Parameters

TSymbol

This type must be comparable using ==, or you should feed an IEqualityComparer.

Inheritance
LSystem<TSymbol>
Inherited Members
Extension Methods

Constructors

LSystem()

Creates a new empty LSystem.

public LSystem()

LSystem(IEqualityComparer<TSymbol>)

Constructs a new empty L-System that will use the given comparer to compare symbols.

public LSystem(IEqualityComparer<TSymbol> comparer)

Parameters

comparer IEqualityComparer<TSymbol>

The comparer to use to compare symbols.

Methods

AddRewriteRule(TSymbol, IEnumerable<TSymbol>)

Adds a new rewrite rule to the system.

public void AddRewriteRule(TSymbol symbol, IEnumerable<TSymbol> replacement)

Parameters

symbol TSymbol
replacement IEnumerable<TSymbol>

Rewrite(IEnumerable<TSymbol>)

Rewrites a string using the rewrite rules.

public IEnumerable<TSymbol> Rewrite(IEnumerable<TSymbol> str)

Parameters

str IEnumerable<TSymbol>

The string to rewrite.

Returns

IEnumerable<TSymbol>

The rewritten string.

Rewrite(IEnumerable<TSymbol>, int)

Performs a rewrite on a string using the rewrite rules n times.

public IEnumerable<TSymbol> Rewrite(IEnumerable<TSymbol> str, int n)

Parameters

str IEnumerable<TSymbol>

The string to rewrite.

n int

The number of times to rewrite it.

Returns

IEnumerable<TSymbol>

The rewritten string.