コード例 #1
0
        private void findMax_Click(object sender, RoutedEventArgs e)
        {
            int count = 0;

            while (true)
            {
                for (int i = 0; i < 5; i++)
                {
                    Crossing crossing = new Crossing(dgList.Last());
                    dgList.Add(crossing.startCrossing());
                    if (dgList.Last().X0 == dgList.Last().X1&& dgList.Last().X0 == dgList.Last().X2&& dgList.Last().X0 == dgList.Last().X3)
                    {
                        count++;
                    }
                    else
                    {
                        count = 0;
                    }
                    if (count == 3)
                    {
                        break;
                    }
                }
                dgList.Add(dgList.Last().mutation());
                if (count == 3)
                {
                    valueLabel.Content = "Максимум: " + dgList[dgList.Count - 2].X0; break;
                }
            }
        }
コード例 #2
0
        private void stepBtn_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < 5; i++)
            {
                Crossing crossing = new Crossing(dgList.Last());
                dgList.Add(crossing.startCrossing());
            }

            dgList.Add(dgList.Last().mutation());
        }