private void TimerFbSw_Tick(object sender, EventArgs e) //Animación Recorre cadena { if (contadorFb >= tiempoFb) { for (int i = 0; i < 10; i++) { ConstruidaFb[i] = null; } TimerFbSw.Stop(); } else { TiempoFB.Text = "Tiempo: " + (contadorFb + 1); if (movSCFb[contadorFb] == 'I') { numScareCFb[otroScareCrowFb].Location = new Point((600 - (60 * (movimientosScareCrowFb + 1))), 10); } //540,480,420,360,300,240,180,120,60,0 //540,480,420,360,300,240,180 else { numScareCFb[otroScareCrowFb].Location = new Point((600 - (60 * (movimientosScareCrowFb))), 20); } if (movSCFb[contadorFb] == 'A' && movSCFb[contadorFb + 1] == 'I') { otroScareCrowFb++; movimientosScareCrowFb = -1; } } movimientosScareCrowFb++; contadorFb++; }
public void RecibirCadena(String numScarecrow) { int x = 60, x0 = 10; ConstruidaGreedy = new PictureBox[10]; ConstruidaFb = new PictureBox[10]; this.tam_terreno = numScarecrow.Length; generarObjF = 10 - tam_terreno; if (generarObjF != 0) { for (int i = 0; i < generarObjF; i++) { numScarecrow = numScarecrow + "#"; } } this.tam_terreno = numScarecrow.Length; this.terreno = new char[tam_terreno]; this.terreno = numScarecrow.ToCharArray(); for (int i = 0; i < 10; i++) { ConstruidaGreedy[i] = new PictureBox(); ConstruidaFb[i] = new PictureBox(); if (i == 0) { ConstruidaGreedy[i].Location = new Point(x0, 40); ConstruidaFb[i].Location = new Point(x0, 40); } else { ConstruidaGreedy[i].Location = new Point(x0 + (x * i), 40); ConstruidaFb[i].Location = new Point(x0 + (x * i), 40); } if (terreno[i] == '.') { ConstruidaGreedy[i].Image = ProyectoDeAlgoritmos.Properties.Resources.Maiz; ConstruidaFb[i].Image = ProyectoDeAlgoritmos.Properties.Resources.Maiz; } else { ConstruidaGreedy[i].Image = ProyectoDeAlgoritmos.Properties.Resources.Tierra; ConstruidaFb[i].Image = ProyectoDeAlgoritmos.Properties.Resources.Tierra; } ConstruidaGreedy[i].SizeMode = PictureBoxSizeMode.Normal; ConstruidaFb[i].SizeMode = PictureBoxSizeMode.Normal; ConstruidaGreedy[i].Size = new System.Drawing.Size(40, 45); ConstruidaFb[i].Size = new System.Drawing.Size(40, 45); ConstruidaGreedy[i].Show(); ConstruidaFb[i].Show(); panel1.Controls.Add(ConstruidaGreedy[i]); panel2.Controls.Add(ConstruidaFb[i]); } ScarecrowFuerzaBruta(); ScarecrowGreedy(); Thread.Sleep(100); TimerGreedySw.Start(); TimerFbSw.Start(); }