Beispiel #1
0
        public Program()
        {
            var world = new World(targetValue: 50, populationSize: 100, mutationChance: 0.3d, minValue: -50, maxValue: 50);

            do
            {
               PrintWorld(world);
            } while (!world.AdvanceGeneration() && !world.Apocalypse);

            if (world.Apocalypse)
            {
                Console.WriteLine("No suitable solution has been found with the given parameters");
            }
            else
            {
                PrintWorld(world);
                Console.WriteLine("Possible solutions after {0} generation(s):", world.Generation);
                foreach (var solution in world.WorkingAlgorithms)
                {
                    Console.WriteLine("{0}: {1}", solution.Name, solution.GetDisplay());
                }
            }
        }