static void Main(string[] args)
        {
            GetAppInfo(); // Run GetAppInfo function to get info

            while (true)
            {
                TestShakespeare ts = new TestShakespeare();
                ts.Start();
                while (ts.ga.BestFitness < 1)
                {
                    ts.Update();
                }
                // Ask to play again
                PrintColourMessage(ConsoleColor.Yellow, "Run again? [Y or N]");

                // Get answer
                string answer = Console.ReadLine().ToUpper();
                if (answer == "Y")
                {
                    continue;
                }
                else if (answer == "N")
                {
                    return;
                }
                else
                {
                    return;
                }
            }
        }
Exemple #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            testShakespeare.Update();

            label1.Text = testShakespeare.numGenerationsText;
            labelbestFitnessText.Text = testShakespeare.getBestFitness().ToString();
            labelbestText.Text        = testShakespeare.bestText;
            listBox1.DataSource       = testShakespeare.getPopulacao();

            progressBar1.Value = (int)(testShakespeare.getBestFitness() * 100);

            if (testShakespeare.getBestFitness() == 1)
            {
                timer1.Enabled = false;
                return;
            }
        }