Example #1
0
 /* Refused, seems bad to me
  * delegate void SalesmanAlgo();
  * private void Universal_Click(object sender, EventArgs e)
  * {
  *  SalesmanAlgo[] algorithm = { RunGeneticAlgorithmAsync, RunHillClimbingAlgorithmIterAsync, RunHillClimbingAlgorithmAsync };
  *  SafeGenerate();
  *  DrawMap();
  *  UnlockInterface(false);
  *  CurrentGeneration = 0;
  *  // Supposed that buton tabIndex coincedence with algorithms
  *  algorithm[(sender as Button).TabIndex]();
  * }*/
 private void SafeGenerate()
 {
     if (!isGenerated)
     {
         GenerateBtn.PerformClick();
     }
 }
Example #2
0
 private void GUI_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyValue == (char)Keys.Enter)
     {
         GenerateBtn.PerformClick();
     }
 }
Example #3
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            graphic             = Map.CreateGraphics();
            CityRedPen          = new Pen(color: Color.Red, width: 3);
            CityBluePen         = new Pen(color: Color.Blue, width: 3);
            WayBlackPen         = new Pen(color: Color.Black, width: 2);
            HomeWayGreenPen     = new Pen(color: Color.Green, width: 2);
            PossibleCityBluePen = new Pen(color: Color.Blue, width: 1);
            ChoosenCityBlackPen = new Pen(color: Color.Black, width: 1);

            run = true;
            currentGeneration  = 0;
            maxGeneration      = GenerationTrackBar.Value;
            DoubleNumberFormat = "#.###";
            Delay = DelayTrackBar.Value;

            lookAtCurrentCityIndex = 0;
            lookAtPrevCityIndex    = 0;

            GenerateBtn.PerformClick();
        }