public void Generar_RND(int Longitud) {/* Genera un Vector de Longitud igual al parametro, pero con valores al Azar*/ this.Clear(); Tiles T1 = Grilla.NuevoTile(); T1.CR_RND(); T1.Id = 1; this.AddTile(T1); for (int i = 2; i <= Longitud; i++) { if (this.HayLugarParaVecinosOrtogonales(T1)) { Random rand = new Random(); int i_rnd = rand.Next(0, 4); if (i_rnd == 4) { i_rnd = 3; } Tiles Tv = T1.VecinoOrtogonal(i_rnd); while ((Tv == null) || (this.ExisteTile(Tv))) { i_rnd = (i_rnd + 1) % 4; Tv = T1.VecinoOrtogonal(i_rnd); } Tv.Valor = RandomizeFHA.Next(1, 8); Tv.Id = i; this.AddTile(Tv); T1 = Tv; } else { break; } } }
public void NuevoJuego(int Cant_Soldados, int Tam_Soldado, int Cant_Enemigos, int Tam_Enemigo) { tileSeleccionado = null; vectorSeleccionado = null; vectorNuevo = null; MisVectores.Clear(); WN_Vectores.Clear(); RandomizeFHA.Reset(); //Enemigos WN_Vectores.Clear(); WN_Vectores.GenerarVectores(Cant_Enemigos, Tam_Enemigo, this, false); foreach (Vector v in WN_Vectores) { foreach (Tiles T in v) { T.Valor = T.Valor * -1; } } LimpiarGrilla(); Mostrar(); //Soldados VectoresNuevos = new ListaVectores(this); VectoresNuevos.GenerarVectores(Cant_Soldados, Tam_Soldado, this, true); PuntosSoldados = VectoresNuevos.ValorTotal(); PuntosEnemigos = WN_Vectores.ValorTotal(); RecuperarMejorRazon(); }
public void CR_RND() { this.Col = RandomizeFHA.Next(0, MainPage.DIMENSION_C - 1); this.Row = RandomizeFHA.Next(0, MainPage.DIMENSION_F - 1); this.Valor = RandomizeFHA.Next(1, 8); }