Esempio n. 1
0
 public void CheckNew()
 {
     lock (loker)
     {
         for (int i = 0; i < population.Areas.Count - 1; i++)
         {
             Individual ind = population.Areas[i][0];
             for (int j = 0; j < population.Areas[i].Count; j++)
             {
                 if (population.Areas[i][j].LifeTime < 0)
                 {
                     Individual ind2 = population.Areas[i][j];
                     population.Areas[i].Remove(ind2);
                 }
                 else
                 {
                     if (!population.Areas[i][j].IsChecked)
                     {
                         if (Math.Sqrt(Math.Pow(ind.Center.X - population.Areas[i][j].Center.X, 2) + Math.Pow(ind.Center.Y - population.Areas[i][j].Center.Y, 2)) < ind.size)
                         {
                             Individual some = ind.GenerateDescendant(ind, population.Areas[i][j], ColorOfRegion(ind.Center));
                             population.Areas[i].Add(some);
                             richTextBox1.Invoke((new MethodInvoker(delegate() { richTextBox1.AppendText("+ one descendant\n"); })));
                             Sheet.DrawRectangle(some.pen, some.rectangle);
                         }
                     }
                 }
             }
             ind.IsChecked = true;
         }
     }
     Thread.Sleep(10);
 }