Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            DNA firstStep = new DNA();

            spark = firstStep.Strand;
            bool t         = false;
            int  iteration = 0;

            ConsoleKeyInfo end = new ConsoleKeyInfo();

            Console.WriteLine("AI solver will attempt equations after GA designs them");
            NaturalSelection  ns = new NaturalSelection();
            IntellegentDesign id = new IntellegentDesign();

            id.initialize();
            ns.darwin(spark);
            do
            {
                if (t == false)
                {
                    t = true;
                    Root(ns, id);
                }
                ns.darwin(id.dueronomy(ns.vA));
                Root(ns, id);
                if (iteration > 100 || novelAns >= cap)
                {
                    end       = Console.ReadKey();
                    iteration = 0;
                    novelAns  = 0;
                }
                iteration++;
            } while (end.Key != ConsoleKey.Escape);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            DNA firstStep = new DNA();
            spark = firstStep.Strand;
            bool t = false;
            int iteration = 0;

            ConsoleKeyInfo end = new ConsoleKeyInfo();
            Console.WriteLine("AI solver will attempt equations after GA designs them");
            NaturalSelection ns = new NaturalSelection();
            IntellegentDesign id = new IntellegentDesign();
            id.initialize();
            ns.darwin(spark);
            do
            {

                if (t==false)
                {
                    t = true;
                    Root(ns,id);
                }
                ns.darwin(id.dueronomy(ns.vA));
                Root(ns, id);
                if (iteration>100||novelAns>=cap)
                {
                    end = Console.ReadKey();
                    iteration = 0;
                    novelAns = 0;
                }
                iteration++;

            } while (end.Key != ConsoleKey.Escape);
        }
Ejemplo n.º 3
0
        private DNA[] populate()
        {
            motherNature = new IntellegentDesign();
            motherNature.initialize();

            this.Equation();

            organism = new DNA[pop];
            for (int c = 0; c < pop; c++)
            {
                organism[c] = new DNA();
            }
            return(organism);
        }
Ejemplo n.º 4
0
 private static void Root(NaturalSelection N, IntellegentDesign I)
 {
     Ans = I.genesis(N.vA, N.ANS);
     if (Ans != N.X)
     {
         Console.WriteLine("Algorithm found novel answer: {0}", Ans);
         Console.WriteLine("Original Root: {0}", N.X);
         novelAns++;
     }
     else
     {
         Console.WriteLine("Algorithm found trivial answer: {0}", Ans);
     }
     Console.WriteLine("------------------------------------------------------");
 }
Ejemplo n.º 5
0
 private static void Root(NaturalSelection N, IntellegentDesign I)
 {
     Ans = I.genesis(N.vA, N.ANS);
     if (Ans != N.X)
     {
         Console.WriteLine("Algorithm found novel answer: {0}", Ans);
         Console.WriteLine("Original Root: {0}", N.X);
         novelAns++;
     }
     else
     {
         Console.WriteLine("Algorithm found trivial answer: {0}", Ans);
     }
     Console.WriteLine("------------------------------------------------------");
 }