public static LSystemStepper FloatSystem( IEnumerable <string> rules, string[] globalParameters = null, string includedCharacters = "[]ABCDEFD", int branchOpenSymbol = '[', int branchCloseSymbol = ']') { var compiledRules = RuleParser.CompileRules( rules, out var nativeRuleData, branchOpenSymbol, branchCloseSymbol, globalParameters ); var customSymbols = new CustomRuleSymbols { branchOpenSymbol = branchOpenSymbol, branchCloseSymbol = branchCloseSymbol }; return(new LSystemStepper( compiledRules, nativeRuleData, customSymbols, globalParameters?.Length ?? 0, includedContextualCharactersByRuleIndex: new[] { new HashSet <int>(includedCharacters.Select(x => (int)x)) } )); }
public void RuleCompilationFailsWhenSuffixContextsMatchSemanticallyButNotLiterally() { Assert.Throws <LSystemRuntimeException>(() => { var compiledRules = RuleParser.CompileRules(new string[] { "A > B[C]D -> AB", "A > B[C][D] -> CA", }, out var nativeData, '[', ']'); }); }
public void RuleCompilationFailsWhenContextMatchesOfDifferentTypesTryToShareProbability() { Assert.Throws <LSystemRuntimeException>(() => { var compiledRules = RuleParser.CompileRules(new string[] { "P(0.5) | A > B -> AB", "P(0.5) | A > BC -> CA", }, out var nativeData, '[', ']'); }); }
public void RuleCompilationFailsWhenContextMatchesOfDifferentTypesMatchSamePattern() { Assert.Throws <LSystemRuntimeException>(() => { var compiledRules = RuleParser.CompileRules(new string[] { "C < A > B[C][D] -> AB", "C < A > B[C][D] -> CA", }, out var nativeData, '[', ']'); }); }
public void RuleCompilationFailsWhenConflictingRules() { Assert.Throws <LSystemRuntimeException>(() => { var compiledRules = RuleParser.CompileRules(new string[] { "A -> AB", "A -> CA", }, out var nativeData, '[', ']'); }); }