using System; using System.Collections.Generic; namespace frame { /*ce code ne sert qu'a itérer le L-System à partire des regles*/ public class Lsystem { public string Tree; public string start; public Dictionary rules= new Dictionary(); public Lsystem () { // Tree= "X"; // rules = new Dictionary() {{"X" , "F-[[X]+X]+F[+FX]-X"},{"F", "F[+F]F[-F]F"}}; Tree= "F"; rules = new Dictionary() {{"F", "F[-F]F[+F][F]"}}; // Tree= "F"; // rules = new Dictionary() {{"F", "FF-[-F+F+F]+[+F-F-F]"}}; // Tree= "F"; // rules = new Dictionary() {{"F", "F[+F]F[-F]F"}}; } public string iterate(){ string newtree = ""; for (int j=0;j pair in rules){ if (i == pair.Key){ i = pair.Value ; break; } } newtree = newtree + i; } Tree = newtree; return newtree; } } }