コード例 #1
0
        public void RecibirCadena(String numSoldados)
        {
            int x = 70, x0 = 20;

            this.tam_fila   = numSoldados.Length;
            generardatosExt = 11 - tam_fila;
            if (generardatosExt != 0)
            {
                for (int i = 0; i < generardatosExt; i++)
                {
                    numSoldados = numSoldados + 'F';
                }
            }
            this.Fila        = new char[11];
            this.Fila        = numSoldados.ToCharArray();
            ConstruidaGreedy = new PictureBox[tam_fila];
            ConstruidaFb     = new PictureBox[tam_fila];
            for (int i = 0; i < tam_fila; i++)
            {
                ConstruidaGreedy[i] = new PictureBox();
                ConstruidaFb[i]     = new PictureBox();
                if (i == 0)
                {
                    ConstruidaGreedy[i].Location = new Point(x0, 30);
                    ConstruidaFb[i].Location     = new Point(x0, 30);
                }
                else
                {
                    ConstruidaGreedy[i].Location = new Point(x0 + (x * i), 30);
                    ConstruidaFb[i].Location     = new Point(x0 + (x * i), 30);
                }
                if (Fila[i] == '1')
                {
                    ConstruidaGreedy[i].Image = ProyectoDeAlgoritmos.Properties.Resources.PrimerSoladado;
                    ConstruidaFb[i].Image     = ProyectoDeAlgoritmos.Properties.Resources.PrimerSoladado;
                }
                else if (Fila[i] == '0')
                {
                    ConstruidaGreedy[i].Image = ProyectoDeAlgoritmos.Properties.Resources.SandGFb;
                    ConstruidaFb[i].Image     = ProyectoDeAlgoritmos.Properties.Resources.SandGFb;
                }
                ConstruidaGreedy[i].SizeMode = PictureBoxSizeMode.Normal;
                ConstruidaFb[i].SizeMode     = PictureBoxSizeMode.Normal;
                ConstruidaGreedy[i].Size     = new System.Drawing.Size(50, 50);
                ConstruidaFb[i].Size         = new System.Drawing.Size(50, 50);
                ConstruidaGreedy[i].Show();
                ConstruidaFb[i].Show();
                panel1.Controls.Add(ConstruidaGreedy[i]);
                panel2.Controls.Add(ConstruidaFb[i]);
            }
            SoldadosFb();
            SoldadosGreedy();
            Thread.Sleep(100);
            TimerGreedySoldados.Start();
            TimerFbSoldados.Start();
        }
コード例 #2
0
 private void TimerGreedySoldados_Tick(object sender, EventArgs e)
 {
     if (contadorGreedy > segundosGr)
     {
         TimerGreedySoldados.Stop();
     }
     else
     {
         TiempoGreedy.Text = "Tiempo: " + (contadorGreedy + 1);
     }
     contadorGreedy++;
 }