//Methods private LSystem Crossover(LSystem lparent, LSystem rparent) { return(LSystem.Crossover(lparent, rparent)); }
static void Main(string[] args) { //File path for level xml string path = "../../levels/level-04.xml"; Dictionary <string, string> materialKey = new Dictionary <string, string> { { "W", "wood" }, { "S", "stone" }, { "I", "ice" }, { "A", "air" } }; Dictionary <string, Tuple <List <string>, List <double> > > rules1 = new Dictionary <string, Tuple <List <string>, List <double> > > { { "1", new Tuple <List <string>, List <double> >(new List <string> { "1", "212" }, new List <double> { 0.80, 0.20 }) }, { "4", new Tuple <List <string>, List <double> >(new List <string> { "4", "141" }, new List <double> { 0.60, 0.40 }) }, { "2", new Tuple <List <string>, List <double> >(new List <string> { "2", "26262" }, new List <double> { 0.20, 0.80 }) } }; Dictionary <string, Tuple <List <string>, List <double> > > rules2 = new Dictionary <string, Tuple <List <string>, List <double> > > { { "2", new Tuple <List <string>, List <double> >(new List <string> { "2", "234" }, new List <double> { 0.80, 0.20 }) }, { "4", new Tuple <List <string>, List <double> >(new List <string> { "654", "34652" }, new List <double> { 0.60, 0.40 }) }, { "6", new Tuple <List <string>, List <double> >(new List <string> { "6", "64574" }, new List <double> { 0.20, 0.80 }) } }; //LSystem r1 = new LSystem(rules1, 3, 5); LSystem r1 = new LSystem(6, 10); //LSystem r2 = new LSystem(rules2, 3, 5); LSystem r2 = new LSystem(6, 10); LSystem r3 = LSystem.Crossover(r1, r2); //Iterate through L-system r3.Iterate(3); //Start writing in level file StartFile(path); WriteBlocksToFile(r3, path); EndFile(path); foreach (string axiom in r3.iterations) { Console.WriteLine(axiom); } Console.WriteLine(LSystem.Encode(r3)); Console.ReadKey(); }