script: name:Evolve for speed vs gravity help:Evolve for speed in different gravity settings code:~ function main(gravity,min_evaluations) { Math.randomize(); World.wrldg=gravity; Populations[0].perfperiod=100000; //fitness: velocity serves as distance (because sampling period is longer than lifespan) ExpParams.initialgen="XX[|,1:1][N,1:1,2:1][T][G]"; Simulator.init(); //Simulator.print(GenePools[0][0].genotype); //ensure the initialgen is in the gene pool Simulator.start(); while (Simulator.running) Simulator.step(); //runs until the experiment stops by itself var best=GenePools[0].best(); Simulator.print("%g (x%g) %s" % best.fit % best.popsiz % best.genotype); // Now, since we have indeterminism (default.sim used: random initialization of neural states and random placement of creatures), // we cannot trust fitness values that have not been confirmed (averaged) during multiple evaluations. // So we start another phase where we wait until the best genotype is evaluated at least min_evaluations times. // No new genotypes are introduced in this phase. ExpParams.stagnation=0; //turn off stagnation detection mechanism ExpParams.p_mut=0; //we don't want evolution and new genotypes anymore. We only want to evaluate existing genotypes multiple times ExpParams.p_xov=0; Simulator.start(); while (Simulator.running && best.popsiz0 && Simulator.running; t--) Simulator.step(); // simulate 'expected lifespan' steps after which 'best' may have changed. This helps avoid too frequent calls to best() best=GenePools[0].best(); } Simulator.stop(); Simulator.print("%g (x%g) %s" % best.fit % best.popsiz % best.genotype); } ~