Páginas

domingo, 28 de agosto de 2011

Simulador Mundial de Futbol 2010

Miguel Hernandez, ha desarrollado este programa, super interesante como vereis en las capturas y ejemplo de:
guardar datos en el mismo directorio donde se este ejecutanto el programa
escuchar un archivo wav.
Aqui teneis el enlace de descarga.



Nota:
He añadido la banda sonora (con lo cual el archivo de descarga es mucho mayor, 38 mb, convertir el archivo .mp3 a .wav, para ejecutarlo con el componente gb.sdl.sound, utilizando la pagina web: http://media-convert.com/conversion/ )
y modificado la presentacion con TABSTRIP
Aqui teneis parte del codigo:
Codigo del sonido:
PUBLIC SUB Form_Open()
DIM sonido AS NEW sound(Application.Path &/ “/Data/bso.wav”)
var.cuenta_atras = 10
ME.Center
sonido.play
END
‘ Gambas class file
PRIVATE puntos AS NEW Integer[]
PRIVATE datos AS NEW String[]
PRIVATE partidos AS NEW String[]
PRIVATE equipos AS NEW String[]
PRIVATE bandera AS NEW String[]
PUBLIC e1 AS String
PUBLIC e2 AS String
PUBLIC SUB Form_Open()
DIM i AS Integer
DIM separa AS String[]
DIM arch AS File
DIM linea AS String
arch = OPEN “Data/equipos.fwc” FOR INPUT
FOR i = 0 TO 31
LINE INPUT #arch, linea
separa = Split(linea, “;”)
bandera.Add(separa[5])
equipos.Add(separa[0])
NEXT
arch.Close
ME.Center
cboGrupos.Text = “A”
cboGrupos_Click()
cbEquipos.text = “Alemania”
cbEquipos.Current.Text = “Alemania”
cbEquipos_Click()
mfase2_Click()
mVer_Click
END
PUBLIC SUB Button2_Click()
DIM i AS Integer
DIM arch AS File
DIM linea AS String
DIM separa AS NEW String[]
DIM datas AS NEW String[]
arch = OPEN “Data/partidos.fwc” FOR INPUT
WHILE NOT Eof(arch)
LINE INPUT #arch, linea
separa.Add(linea)
WEND
arch.Close
separa[Label2.Caption - 1] = cboGrupos.Text & “;” & Label2.Caption & “;” & Label8.Caption & “;” & Label14.Caption & “;” & label20.caption & “;” & Label26.Caption & “;” & label32.Caption & “;” & v1.value & “;” & v2.Value & “;” & CheckBox1.Value
separa[Label3.Caption - 1] = cboGrupos.Text & “;” & Label3.Caption & “;” & Label9.Caption & “;” & Label15.Caption & “;” & label21.caption & “;” & Label27.Caption & “;” & label33.Caption & “;” & v4.value & “;” & v3.Value & “;” & CheckBox2.Value
separa[Label4.Caption - 1] = cboGrupos.Text & “;” & Label4.Caption & “;” & Label10.Caption & “;” & Label16.Caption & “;” & label22.caption & “;” & Label28.Caption & “;” & label34.Caption & “;” & v6.value & “;” & v5.Value & “;” & CheckBox3.Value
separa[Label5.Caption - 1] = cboGrupos.Text & “;” & Label5.Caption & “;” & Label11.Caption & “;” & Label17.Caption & “;” & label23.caption & “;” & Label29.Caption & “;” & label35.Caption & “;” & v8.value & “;” & v7.Value & “;” & CheckBox4.Value
separa[Label6.Caption - 1] = cboGrupos.Text & “;” & Label6.Caption & “;” & Label12.Caption & “;” & Label18.Caption & “;” & label24.caption & “;” & Label30.Caption & “;” & label36.Caption & “;” & v10.value & “;” & v9.Value & “;” & CheckBox5.Value
separa[Label7.Caption - 1] = cboGrupos.Text & “;” & Label7.Caption & “;” & Label13.Caption & “;” & Label19.Caption & “;” & label25.caption & “;” & Label31.Caption & “;” & label37.Caption & “;” & v12.value & “;” & v11.Value & “;” & CheckBox6.Value
arch = OPEN Application.Path &/ “Data/partidos.fwc” FOR OUTPUT
FOR i = 0 TO 47
PRINT #arch, separa[i]
NEXT
arch.Close
END
PUBLIC SUB carga(letra AS String)
DIM i AS Integer
DIM separa AS String[]
DIM arch AS File
DIM linea AS String
puntos.Clear
datos.Clear
partidos.Clear
arch = OPEN “Data/partidos.fwc” FOR INPUT
FOR i = 1 TO 48
LINE INPUT #arch, linea
separa = Split(linea, “;”)
IF Comp(separa[0], letra) = 0 THEN
partidos.Add(linea)
ENDIF
NEXT
arch.Close
separa.Clear
linea = NULL
mostrar_partidos()
END
PRIVATE SUB generar_datos()
DIM i AS Integer
DIM separa AS String[]
DIM linea AS String
datos.Clear
puntos.Clear
IF CheckBox1.Value = -1 THEN
IF v1.Value > v2.Value THEN
datos.Add(Label26.Caption & “;” & 1 & “;” & 1 & “;” & 0 & “;” & 0 & “;” & v1.Value & “;” & v2.Value & “;” & 3)
datos.Add(Label32.Caption & “;” & 1 & “;” & 0 & “;” & 0 & “;” & 1 & “;” & v2.Value & “;” & v1.Value & “;” & 0)
puntos.Add(3)
puntos.Add(0)
ENDIF
IF v1.Value < v2.Value THEN
datos.Add(Label32.Caption & “;” & 1 & “;” & 1 & “;” & 0 & “;” & 0 & “;” & v2.Value & “;” & v1.Value & “;” & 3)
datos.Add(Label26.Caption & “;” & 1 & “;” & 0 & “;” & 0 & “;” & 1 & “;” & v1.Value & “;” & v2.Value & “;” & 0)
puntos.Add(3)
puntos.Add(0)
ENDIF
IF v1.Value = v2.Value THEN
datos.Add(Label32.Caption & “;” & 1 & “;” & 0 & “;” & 1 & “;” & 0 & “;” & v2.Value & “;” & v1.Value & “;” & 1)
datos.Add(Label26.Caption & “;” & 1 & “;” & 0 & “;” & 1 & “;” & 0 & “;” & v1.Value & “;” & v2.Value & “;” & 1)
puntos.Add(1)
puntos.Add(1)
ENDIF
ELSE
datos.Add(Label32.Caption & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0)
datos.Add(Label26.Caption & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0)
puntos.Add(0)
puntos.Add(0)
ENDIF
IF CheckBox2.Value = -1 THEN
IF v4.Value > v3.Value THEN
datos.Add(Label27.Caption & “;” & 1 & “;” & 1 & “;” & 0 & “;” & 0 & “;” & v4.Value & “;” & v3.Value & “;” & 3)
datos.Add(Label33.Caption & “;” & 1 & “;” & 0 & “;” & 0 & “;” & 1 & “;” & v3.Value & “;” & v4.Value & “;” & 0)
puntos.Add(3)
puntos.Add(0)
ENDIF
IF v4.Value < v3.Value THEN
datos.Add(Label33.Caption & “;” & 1 & “;” & 1 & “;” & 0 & “;” & 0 & “;” & v3.Value & “;” & v4.Value & “;” & 3)
datos.Add(Label27.Caption & “;” & 1 & “;” & 0 & “;” & 0 & “;” & 1 & “;” & v4.Value & “;” & v3.Value & “;” & 0)
puntos.Add(3)
puntos.Add(0)
ENDIF
IF v4.Value = v3.Value THEN
datos.Add(Label33.Caption & “;” & 1 & “;” & 0 & “;” & 1 & “;” & 0 & “;” & v3.Value & “;” & v4.Value & “;” & 0)
datos.Add(Label27.Caption & “;” & 1 & “;” & 0 & “;” & 1 & “;” & 0 & “;” & v4.Value & “;” & v3.Value & “;” & 0)
puntos.Add(1)
puntos.Add(1)
ENDIF
ELSE
datos.Add(Label33.Caption & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0)
datos.Add(Label27.Caption & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0 & “;” & 0)
puntos.Add(0)
puntos.Add(0)
ENDIF
IF CheckBox3.Value = -1 THEN
IF v6.Value > v5.Value THEN
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label28.Caption, separa[0]) = 0 THEN
linea = Label28.Caption & “;” & 2 & “;” & (Val(separa[2]) + 1) & “;” & separa[3] & “;” & separa[4] & “;” & (Val(separa[5]) + v6.Value) & “;” & (Val(separa[6]) + v5.Value) & “;” & (separa[7] + 3)
datos[i] = linea
puntos[i] = puntos[i] + 3
ENDIF
NEXT
separa.Clear
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label34.Caption, separa[0]) = 0 THEN
linea = Label34.Caption & “;” & 2 & “;” & separa[2] & “;” & separa[3] & “;” & (Val(separa[4]) + 1) & “;” & (Val(separa[5]) + v5.Value) & “;” & (Val(separa[6]) + v6.Value) & “;” & separa[7]
datos[i] = linea
ENDIF
NEXT
ENDIF
IF v6.Value < v5.Value THEN
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label34.Caption, separa[0]) = 0 THEN
linea = Label34.Caption & “;” & 2 & “;” & (Val(separa[2]) + 1) & “;” & separa[3] & “;” & separa[4] & “;” & (Val(separa[5]) + v5.Value) & “;” & (Val(separa[6]) + v6.Value) & “;” & (Val(separa[7]) + 3)
datos[i] = linea
puntos[i] = puntos[i] + 3
ENDIF
NEXT
separa.Clear
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label28.Caption, separa[0]) = 0 THEN
linea = Label28.Caption & “;” & 2 & “;” & separa[2] & “;” & separa[3] & “;” & (Val(separa[4]) + 1) & “;” & (Val(separa[5]) + v6.Value) & “;” & (Val(separa[6]) + v5.Value) & “;” & separa[7]
datos[i] = linea
ENDIF
NEXT
ENDIF
IF v6.Value = v5.Value THEN
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label28.Caption, separa[0]) = 0 THEN
linea = Label28.Caption & “;” & 2 & “;” & separa[2] & “;” & (Val(separa[3]) + 1) & “;” & separa[4] & “;” & (Val(separa[5]) + v6.Value) & “;” & (Val(separa[6]) + v5.Value) & “;” & (Val(separa[7]) + 1)
datos[i] = linea
puntos[i] = puntos[i] + 1
ENDIF
NEXT
separa.Clear
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label34.Caption, separa[0]) = 0 THEN
linea = Label34.Caption & “;” & 2 & “;” & separa[2] & “;” & (Val(separa[3]) + 1) & “;” & separa[4] & “;” & (Val(separa[5]) + v5.Value) & “;” & (Val(separa[6]) + v6.Value) & “;” & (Val(separa[7]) + 1)
datos[i] = linea
puntos[i] = puntos[i] + 1
ENDIF
NEXT
ENDIF
ENDIF
IF CheckBox4.Value = -1 THEN
IF v8.Value > v7.Value THEN
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label29.Caption, separa[0]) = 0 THEN
linea = Label29.Caption & “;” & 2 & “;” & (Val(separa[2]) + 1) & “;” & separa[3] & “;” & separa[4] & “;” & (Val(separa[5]) + v8.Value) & “;” & (Val(separa[6]) + v7.Value) & “;” & (Val(separa[7]) + 3)
datos[i] = linea
puntos[i] = puntos[i] + 3
ENDIF
NEXT
separa.Clear
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label35.Caption, separa[0]) = 0 THEN
linea = Label35.Caption & “;” & 2 & “;” & separa[2] & “;” & separa[3] & “;” & (Val(separa[4]) + 1) & “;” & (Val(separa[5]) + v7.Value) & “;” & (Val(separa[6]) + v8.Value) & “;” & separa[7]
datos[i] = linea
ENDIF
NEXT
ENDIF
IF v8.Value < v7.Value THEN
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label35.Caption, separa[0]) = 0 THEN
linea = Label35.Caption & “;” & 2 & “;” & (Val(separa[2]) + 1) & “;” & separa[3] & “;” & separa[4] & “;” & (Val(separa[5]) + v7.Value) & “;” & (Val(separa[6]) + v8.Value) & “;” & (Val(separa[7]) + 3)
datos[i] = linea
puntos[i] = puntos[i] + 3
ENDIF
NEXT
separa.Clear
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label29.Caption, separa[0]) = 0 THEN
linea = Label29.Caption & “;” & 2 & “;” & separa[2] & “;” & separa[3] & “;” & (Val(separa[4]) + 1) & “;” & (Val(separa[5]) + v8.Value) & “;” & (Val(separa[6]) + v7.Value) & “;” & separa[7]
datos[i] = linea
ENDIF
NEXT
ENDIF
IF v8.Value = v7.Value THEN
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label29.Caption, separa[0]) = 0 THEN
linea = Label29.Caption & “;” & 2 & “;” & separa[2] & “;” & (Val(separa[3]) + 1) & “;” & separa[4] & “;” & (Val(separa[5]) + v8.Value) & “;” & (Val(separa[6]) + v7.Value) & “;” & (Val(separa[7]) + 1)
datos[i] = linea
puntos[i] = puntos[i] + 1
ENDIF
NEXT
separa.Clear
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label35.Caption, separa[0]) = 0 THEN
linea = Label35.Caption & “;” & 2 & “;” & separa[2] & “;” & (Val(separa[3]) + 1) & “;” & separa[4] & “;” & (Val(separa[5]) + v7.Value) & “;” & (Val(separa[6]) + v8.Value) & “;” & (Val(separa[7]) + 1)
datos[i] = linea
puntos[i] = puntos[i] + 1
ENDIF
NEXT
ENDIF
ENDIF
IF CheckBox5.Value = -1 THEN
IF v10.Value > v9.Value THEN
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label30.Caption, separa[0]) = 0 THEN
linea = Label30.Caption & “;” & 3 & “;” & (Val(separa[2]) + 1) & “;” & separa[3] & “;” & separa[4] & “;” & (Val(separa[5]) + v10.Value) & “;” & (Val(separa[6]) + v9.Value) & “;” & (Val(separa[7]) + 3)
datos[i] = linea
puntos[i] = puntos[i] + 3
ENDIF
NEXT
separa.Clear
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label36.Caption, separa[0]) = 0 THEN
linea = Label36.Caption & “;” & 3 & “;” & separa[2] & “;” & separa[3] & “;” & (Val(separa[4]) + 1) & “;” & (Val(separa[5]) + v9.Value) & “;” & (Val(separa[6]) + v10.Value) & “;” & separa[7]
datos[i] = linea
ENDIF
NEXT
ENDIF
IF v10.Value < v9.Value THEN
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label36.Caption, separa[0]) = 0 THEN
linea = Label36.Caption & “;” & 3 & “;” & (Val(separa[2]) + 1) & “;” & separa[3] & “;” & separa[4] & “;” & (Val(separa[5]) + v9.Value) & “;” & (Val(separa[6]) + v10.Value) & “;” & (Val(separa[7]) + 3)
datos[i] = linea
puntos[i] = puntos[i] + 3
ENDIF
NEXT
separa.Clear
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label30.Caption, separa[0]) = 0 THEN
linea = Label30.Caption & “;” & 3 & “;” & separa[2] & “;” & separa[3] & “;” & (Val(separa[4]) + 1) & “;” & (Val(separa[5]) + v10.Value) & “;” & (Val(separa[6]) + v9.Value) & “;” & separa[7]
datos[i] = linea
ENDIF
NEXT
ENDIF
IF v10.Value = v9.Value THEN
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label30.Caption, separa[0]) = 0 THEN
linea = Label30.Caption & “;” & 3 & “;” & separa[2] & “;” & (Val(separa[3]) + 1) & “;” & separa[4] & “;” & (Val(separa[5]) + v10.Value) & “;” & (Val(separa[6]) + v9.Value) & “;” & (Val(separa[7]) + 1)
datos[i] = linea
puntos[i] = puntos[i] + 1
ENDIF
NEXT
separa.Clear
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label36.Caption, separa[0]) = 0 THEN
linea = Label36.Caption & “;” & 3 & “;” & separa[2] & “;” & (Val(separa[3]) + 1) & “;” & separa[4] & “;” & (Val(separa[5]) + v9.Value) & “;” & (Val(separa[6]) + v10.Value) & “;” & (Val(separa[7]) + 1)
datos[i] = linea
puntos[i] = puntos[i] + 1
ENDIF
NEXT
ENDIF
ENDIF
IF CheckBox6.Value = -1 THEN
IF v12.Value > v11.Value THEN
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label31.Caption, separa[0]) = 0 THEN
linea = Label31.Caption & “;” & 3 & “;” & (Val(separa[2]) + 1) & “;” & separa[3] & “;” & separa[4] & “;” & (Val(separa[5]) + v12.Value) & “;” & (Val(separa[6]) + v11.Value) & “;” & (Val(separa[7]) + 3)
datos[i] = linea
puntos[i] = puntos[i] + 3
ENDIF
NEXT
separa.Clear
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label37.Caption, separa[0]) = 0 THEN
linea = Label37.Caption & “;” & 3 & “;” & separa[2] & “;” & separa[3] & “;” & (Val(separa[4]) + 1) & “;” & (Val(separa[5]) + v11.Value) & “;” & (Val(separa[6]) + v12.Value) & “;” & separa[7]
datos[i] = linea
ENDIF
NEXT
ENDIF
IF v12.Value < v11.Value THEN
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label37.Caption, separa[0]) = 0 THEN
linea = Label37.Caption & “;” & 3 & “;” & (Val(separa[2]) + 1) & “;” & separa[3] & “;” & separa[4] & “;” & (Val(separa[5]) + v11.Value) & “;” & (Val(separa[6]) + v12.Value) & “;” & (Val(separa[7]) + 3)
datos[i] = linea
puntos[i] = puntos[i] + 3
ENDIF
NEXT
separa.Clear
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label31.Caption, separa[0]) = 0 THEN
linea = Label31.Caption & “;” & 3 & “;” & separa[2] & “;” & separa[3] & “;” & (Val(separa[4]) + 1) & “;” & (Val(separa[5]) + v12.Value) & “;” & (Val(separa[6]) + v11.Value) & “;” & separa[7]
datos[i] = linea
ENDIF
NEXT
ENDIF
IF v12.Value = v11.Value THEN
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label31.Caption, separa[0]) = 0 THEN
linea = Label31.Caption & “;” & 3 & “;” & separa[2] & “;” & (Val(separa[3]) + 1) & “;” & separa[4] & “;” & (Val(separa[5]) + v12.Value) & “;” & (Val(separa[6]) + v11.Value) & “;” & (Val(separa[7]) + 1)
datos[i] = linea
puntos[i] = puntos[i] + 1
ENDIF
NEXT
separa.Clear
FOR i = 0 TO 3
separa = Split(datos[i], “;”)
IF Comp(Label37.Caption, separa[0]) = 0 THEN
linea = Label37.Caption & “;” & 3 & “;” & separa[2] & “;” & (Val(separa[3]) + 1) & “;” & separa[4] & “;” & (Val(separa[5]) + v11.Value) & “;” & (Val(separa[6]) + v12.Value) & “;” & (Val(separa[7]) + 1)
datos[i] = linea
puntos[i] = puntos[i] + 1
ENDIF
NEXT
ENDIF
ENDIF
ordenar_puntos()
END
PRIVATE SUB mostrar_partidos()
DIM i AS Integer
DIM separa AS String[]
FOR i = 0 TO 5
separa = Split(partidos[i], “;”)
SELECT CASE i
CASE 0
Label2.Caption = separa[1]
Label8.Caption = separa[2]
Label14.Caption = separa[3]
Label20.Caption = separa[4]
Label26.Caption = separa[5]
Label32.Caption = separa[6]
v1.Value = separa[7]
v2.Value = separa[8]
IF separa[9] = -1 THEN
CheckBox1.Value = -1
ELSE
CheckBox1.Value = 0
ENDIF
CASE 1
Label3.Caption = separa[1]
Label9.Caption = separa[2]
Label15.Caption = separa[3]
Label21.Caption = separa[4]
Label27.Caption = separa[5]
Label33.Caption = separa[6]
v4.Value = separa[7]
v3.Value = separa[8]
IF separa[9] = -1 THEN
CheckBox2.Value = -1
ELSE
CheckBox2.Value = 0
ENDIF
CASE 2
Label4.Caption = separa[1]
Label10.Caption = separa[2]
Label16.Caption = separa[3]
Label22.Caption = separa[4]
Label28.Caption = separa[5]
Label34.Caption = separa[6]
v6.Value = separa[7]
v5.Value = separa[8]
IF separa[9] = -1 THEN
CheckBox3.Value = -1
ELSE
CheckBox3.Value = 0
ENDIF
CASE 3
Label5.Caption = separa[1]
Label11.Caption = separa[2]
Label17.Caption = separa[3]
Label23.Caption = separa[4]
Label29.Caption = separa[5]
Label35.Caption = separa[6]
v8.Value = separa[7]
v7.Value = separa[8]
IF separa[9] = -1 THEN
CheckBox4.Value = -1
ELSE
CheckBox4.Value = 0
ENDIF
CASE 4
Label6.Caption = separa[1]
Label12.Caption = separa[2]
Label18.Caption = separa[3]
Label24.Caption = separa[4]
Label30.Caption = separa[5]
Label36.Caption = separa[6]
v10.Value = separa[7]
v9.Value = separa[8]
IF separa[9] = -1 THEN
CheckBox5.Value = -1
ELSE
CheckBox5.Value = 0
ENDIF
CASE 5
Label7.Caption = separa[1]
Label13.Caption = separa[2]
Label19.Caption = separa[3]
Label25.Caption = separa[4]
Label31.Caption = separa[5]
Label37.Caption = separa[6]
v12.Value = separa[7]
v11.Value = separa[8]
IF separa[9] = -1 THEN
CheckBox6.Value = -1
ELSE
CheckBox6.Value = 0
ENDIF
END SELECT
NEXT
generar_datos()
END
PRIVATE SUB ordenar_puntos()
DIM maxi, j, i, clave AS Integer
DIM orden AS NEW String[]
DIM dife AS NEW Integer[]
DIM separa AS String[]
DIM ban AS Picture
FOR j = 0 TO 3
maxi = -1
FOR i = 0 TO datos.Count – 1
IF puntos[i] > maxi THEN
maxi = puntos[i]
clave = i
ENDIF
NEXT
orden.Add(datos[clave])
separa = Split(orden[j], “;”)
dife.Add(separa[5] – separa[6])
datos.Remove(clave)
puntos.Remove(clave)
NEXT
puntos.Clear
datos.Clear
FOR i = 0 TO orden.Count – 1
separa = Split(orden[i], “;”)
puntos.Add(separa[7])
NEXT
orden.Add(0)
puntos.Add(-100)
dife.Add(-55)
FOR i = 0 TO orden.Count – 1
IF i > 0 THEN
IF puntos[i] = puntos[i - 1] THEN
IF dife[i] < dife[i - 1] THEN
datos.Add(orden[i - 1])
datos.Add(orden[i])
ELSE
datos.Add(orden[i])
datos.Add(orden[i - 1])
ENDIF
ELSE
datos.Add(orden[i - 1])
datos.Add(orden[i])
ENDIF
ENDIF
NEXT
datos.Remove(2)
datos.Remove(2)
datos.Remove(4)
datos.Remove(4)
cvGrupos.Clear
FOR i = 0 TO datos.Count – 1
separa = Split(datos[i], “;”)
FOR j = 0 TO equipos.Count – 1
IF Comp(separa[0], equipos[j]) = 0 THEN
ban = Picture.Load(Application.Path &/ “img/” & bandera[j])
BREAK
ENDIF
NEXT
cvGrupos.Add(i, separa[0], ban)
cvGrupos[i].Expanded = TRUE
cvGrupos[i][1] = separa[1]
cvGrupos[i][2] = separa[2]
cvGrupos[i][3] = separa[3]
cvGrupos[i][4] = separa[4]
cvGrupos[i][5] = separa[5]
cvGrupos[i][6] = separa[6]
cvGrupos[i][7] = separa[7]
NEXT
e1 = cvGrupos[0][0]
e2 = cvGrupos[1][0]
END
‘**********************************************
‘Frame de Fases II
‘**********************************************
PRIVATE SUB carga_2fase()
DIM i, j AS Integer
DIM separa AS String[]
DIM casos AS NEW String[]
DIM tantos AS NEW Integer[]
DIM banderita AS NEW String[]
DIM arch AS File
DIM linea AS String
arch = OPEN “Data/fase2.fwc” FOR INPUT
FOR i = 0 TO 29
LINE INPUT #arch, linea
separa = Split(linea, “;”)
casos.Add(separa[0])
tantos.Add(separa[1])
FOR j = 0 TO equipos.Count – 1
IF Comp(separa[0], equipos[j]) = 0 THEN
banderita.Add(bandera[j])
ENDIF
NEXT
NEXT
IF banderita.Count = 0 THEN
FOR j = 0 TO 30
banderita.Add(“fifaLogo.gif”)
NEXT
ENDIF
arch.Close
lbl1A.Caption = casos[0]
v1a.Value = tantos[0]
p1.Picture = Picture.Load(“img” &/ banderita[0])
lbl2b.Caption = casos[3]
v2b.Value = tantos[3]
p2.Picture = Picture.Load(“img” &/ banderita[3])
lbl1C.Caption = casos[4]
v1c.Value = tantos[4]
p3.Picture = Picture.Load(“img” &/ banderita[4])
lbl2d.Caption = casos[7]
v2d.Value = tantos[7]
p4.Picture = Picture.Load(“img” &/ banderita[7])
lbl1D.Caption = casos[6]
v1d.Value = tantos[6]
p5.Picture = Picture.Load(“img” &/ banderita[6])
lbl2C.Caption = casos[5]
v2c.Value = tantos[5]
p6.Picture = Picture.Load(“img” &/ banderita[5])
lbl1b.Caption = casos[2]
v1b.Value = tantos[2]
p7.Picture = Picture.Load(“img” &/ banderita[2])
lbl2A.Caption = casos[1]
v2a.Value = tantos[1]
p8.Picture = Picture.Load(“img” &/ banderita[1])
lbl1E.Caption = casos[8]
v1e.Value = tantos[8]
p9.Picture = Picture.Load(“img” &/ banderita[8])
lbl2F.Caption = casos[11]
v2f.Value = tantos[11]
p10.Picture = Picture.Load(“img” &/ banderita[11])
lbl1G.Caption = casos[12]
v1g.Value = tantos[12]
p11.Picture = Picture.Load(“img” &/ banderita[12])
lbl2H.Caption = casos[15]
v2h.Value = tantos[15]
p12.Picture = Picture.Load(“img” &/ banderita[15])
lbl1F.Caption = casos[10]
v1f.Value = tantos[10]
p13.Picture = Picture.Load(“img” &/ banderita[10])
lbl2E.Caption = casos[9]
v2e.Value = tantos[9]
p14.Picture = Picture.Load(“img” &/ banderita[9])
lbl1H.Caption = casos[14]
v1h.Value = tantos[14]
p15.Picture = Picture.Load(“img” &/ banderita[14])
lbl2G.Caption = casos[13]
v2g.Value = tantos[13]
p16.Picture = Picture.Load(“img” &/ banderita[13])
lbl49.Caption = casos[16]
v49.Value = tantos[16]
p17.Picture = Picture.Load(“img” &/ banderita[16])
lbl50.Caption = casos[17]
v50.Value = tantos[17]
p18.Picture = Picture.Load(“img” &/ banderita[17])
lbl51.Caption = casos[18]
v51.Value = tantos[18]
p19.Picture = Picture.Load(“img” &/ banderita[18])
lbl52.Caption = casos[19]
v52.Value = tantos[19]
p20.Picture = Picture.Load(“img” &/ banderita[19])
lbl53.Caption = casos[20]
v53.Value = tantos[20]
p21.Picture = Picture.Load(“img” &/ banderita[20])
lbl54.Caption = casos[21]
v54.Value = tantos[21]
p22.Picture = Picture.Load(“img” &/ banderita[21])
lbl55.Caption = casos[22]
v55.Value = tantos[22]
p23.Picture = Picture.Load(“img” &/ banderita[22])
lbl56.Caption = casos[23]
v56.Value = tantos[23]
p24.Picture = Picture.Load(“img” &/ banderita[23])
lbl57.Caption = casos[25]
v57.Value = tantos[25]
p25.Picture = Picture.Load(“img” &/ banderita[25])
lbl58.Caption = casos[26]
v58.Value = tantos[26]
p26.Picture = Picture.Load(“img” &/ banderita[26])
lbl59.Caption = casos[24]
v59.Value = tantos[24]
p27.Picture = Picture.Load(“img” &/ banderita[24])
lbl60.Caption = casos[27]
v60.Value = tantos[27]
p28.Picture = Picture.Load(“img” &/ banderita[27])
lbl61.Caption = casos[28]
v61.Value = tantos[28]
p29.Picture = Picture.Load(“img” &/ banderita[28])
lbl62.Caption = casos[29]
v62.Value = tantos[29]
p30.Picture = Picture.Load(“img” &/ banderita[29])
IF v61.Value > v62.Value THEN
Label38.Caption = lbl61.Caption
ELSE
Label38.Caption = lbl62.Caption
ENDIF
END
‘**********************************************************************
‘Configuracion de los equipos
‘************************************************************************
PUBLIC SUB slAtaque_Change()
lblAtaque2.Caption = slAtaque.Value & ” %”
END
PUBLIC SUB slDefensa_Change()
lblDefensa2.Caption = slDefensa.Value & ” %”
END
PUBLIC SUB slTactica_Change()
lblTactica2.Caption = slTactica.Value & ” %”
END
PUBLIC SUB slResistencia_Change()
lblResistencia2.Caption = slResistencia.Value & ” %”
END
PUBLIC SUB cbEquipos_Click()
DIM i AS Integer
DIM separa AS String[]
DIM arch AS File
DIM linea AS String
arch = OPEN “Data/equipos.fwc” FOR INPUT
WHILE NOT Eof(arch)
LINE INPUT #arch, linea
separa = Split(linea, “;”)
IF Comp(separa[0], cbEquipos.Current.Text) = 0 THEN
slAtaque.Value = separa[1]
slDefensa.Value = separa[2]
slTactica.Value = separa[3]
slResistencia.Value = separa[4]
pbbandera.Picture = Picture.Load(“img” &/ separa[5])
BREAK
ENDIF
WEND
arch.Close
Button4.Enabled = TRUE
END
PUBLIC SUB Button4_Click()
DIM i AS Integer
DIM arch AS File
DIM linea AS String
DIM separa AS NEW String[]
DIM datas AS NEW String[]
arch = OPEN “Data/equipos.fwc” FOR INPUT
WHILE NOT Eof(arch)
LINE INPUT #arch, linea
separa = Split(linea, “;”)
IF Comp(separa[0], cbEquipos.Current.Text) = 0 THEN
datas.Add(cbEquipos.Current.Text & “;” & slAtaque.Value & “;” & slDefensa.Value & “;” & slTactica.Value & “;” & slResistencia.Value & “;” & separa[5])
ELSE
datas.Add(linea)
ENDIF
WEND
arch.Close
arch = OPEN Application.Path &/ “Data/equipos.fwc” FOR OUTPUT
FOR i = 0 TO 31
PRINT #arch, datas[i]
NEXT
arch.Close
Button4.Enabled = FALSE
END
PUBLIC SUB Salir_Click()
DIM s AS Integer
s = Message.Question(“Esta seguro de salir?”, “Si”, “No”)
IF s = 1 THEN
QUIT
ENDIF
END
PUBLIC SUB Resetear_Click()
DIM i AS Integer
DIM arch AS File
DIM linea AS String
DIM separa AS NEW String[]
DIM datas AS NEW String[]
arch = OPEN “Data/partidos.fwc” FOR INPUT
FOR i = 0 TO 47
LINE INPUT #arch, linea
separa = Split(linea, “;”)
datas.Add(separa[0] & “;” & separa[1] & “;” & separa[2] & “;” & separa[3] & “;” & separa[4] & “;” & separa[5] & “;” & separa[6] & “;” & 0 & “;” & 0 & “;” & 0)
NEXT
arch.Close
arch = OPEN Application.Path &/ “Data/partidos.fwc” FOR OUTPUT
FOR i = 0 TO 47
PRINT #arch, datas[i]
NEXT
separa.Clear
datas.Clear
FOR i = 0 TO 29
datas.Add(i & “;” & 0)
NEXT
arch = OPEN Application.Path &/ “Data/fase2.fwc” FOR OUTPUT
FOR i = 0 TO 29
PRINT #arch, datas[i]
NEXT
arch.Close
Message.Info(“Sistema Reseteado”)
END
PUBLIC SUB Timer1_Timer()
IF copa.Visible = TRUE THEN
copa.Hide
ELSE
copa.Show
ENDIF
END
PUBLIC SUB Acer_Click()
Facerca.ShowModal()
END
PUBLIC SUB TabStrip1_Click()
‘depende de que tab pulse ejecuta
IF TabStrip1.Caption = “Fase I: Grupos” THEN
cboGrupos.Text = “A”
cboGrupos_Click()
ENDIF
IF TabStrip1.Caption = “Fase II: Torneo” THEN
mfase2_Click()
ENDIF
IF TabStrip1.caption = “Configuracion de Equipos” THEN
cbEquipos.text = “Alemania”
cbEquipos.Current.Text = “Alemania”
mEquipos_Click()
ENDIF
END
PUBLIC SUB ToolButton1_Click()
sml.simulacion()
TabStrip1_Click()
END
Modulo de simulacion:
‘ Gambas module file
‘****************************************
‘Simulacion
‘**************************************** PUBLIC SUB simulacion()
DIM i, j, t, g1, g2 AS Integer
DIM f1, f2, fg1, fg2, fd1, fd2 AS Float
DIM a1, a2, d1, d2, t1, t2, r1, r2, comparacion AS Float
DIM separa AS String[]
DIM separa2 AS String[]
DIM juegos AS NEW String[]
DIM caract AS NEW String[]
DIM arch AS File
DIM linea, eq1, eq2 AS String
DIM letras AS String[] = ["A", "B", "C", "D", "E", "F", "G", "H"]
arch = OPEN “Data/partidos.fwc” FOR INPUT
FOR i = 1 TO 48
LINE INPUT #arch, linea
juegos.Add(linea)
NEXT
arch.Close
arch = OPEN “Data/equipos.fwc” FOR INPUT
WHILE NOT Eof(arch)
LINE INPUT #arch, linea
caract.Add(linea)
WEND
arch.Close
FOR i = 0 TO 47
separa = Split(juegos[i], “;”)
‘PRINT separa[5] & ” vs ” & separa[6]
FOR j = 0 TO caract.Count – 1
separa2 = Split(caract[j], “;”)
IF Comp(separa2[0], separa[5]) = 0 THEN
‘PRINT separa2[0]
‘eq1 = separa2[0]
‘PRINT separa2[1];; separa2[2];; separa2[3];; separa2[4]
a1 = separa2[1] / 100
d1 = separa2[2] / 100
t1 = separa2[3] / 100
r1 = separa2[4] / 100
f1 = (separa2[1] + separa2[2] + separa2[3] + separa2[4]) / 4 / 100
fg1 = separa2[1] / 90
fd1 = separa2[2] / 90
‘PRINT a1;; d1;; t1;; r1;; f1;; fg1;; fd1
ENDIF
NEXT
FOR j = 0 TO caract.Count – 1
separa2 = Split(caract[j], “;”)
IF Comp(separa2[0], separa[6]) = 0 THEN
‘PRINT separa2[0]
‘eq2 = separa2[0]
‘PRINT separa2[1];; separa2[2];; separa2[3];; separa2[4]
a2 = separa2[1] / 100
d2 = separa2[2] / 100
t2 = separa2[3] / 100
r2 = separa2[4] / 100
f2 = (separa2[1] + separa2[2] + separa2[3] + separa2[4]) / 4 / 100
fg2 = separa2[1] / 90
fd2 = separa2[2] / 90
‘PRINT a2;; d2;; t2;; r2;; f2;; fg2;; fd2
ENDIF
NEXT
g2 = 0
g1 = 0
FOR t = 0 TO 20
‘PRINT t
comparacion = Rnd()
IF f1 > comparacion THEN
‘PRINT “Tiene el balon ” & eq1
comparacion = Rnd()
IF comparacion < a1 THEN
comparacion = Rnd()
‘PRINT “ataque de ” & eq1
IF comparacion > d2 THEN
‘PRINT “Peligro por ” & eq1
comparacion = Rnd()
IF comparacion < fg1 THEN
‘PRINT “Disparo a puerta ” & eq1
comparacion = Rnd()
IF comparacion > fd2 THEN
‘PRINT “goool ” & eq1
g1 += 1
ELSE
‘PRINT “Pierde el balon ” & eq1
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
comparacion = Rnd()
IF f2 > comparacion THEN
‘PRINT “Tiene el balon ” & eq2
comparacion = Rnd()
IF comparacion < a2 THEN
comparacion = Rnd()
‘PRINT “ataque de ” & eq2
IF comparacion > d1 THEN
‘PRINT “Peligro por parte de ” & eq2
comparacion = Rnd()
IF comparacion < fg2 THEN
‘PRINT “Disparo a puerta de” & eq2
comparacion = Rnd()
IF comparacion > fd1 THEN
‘PRINT “goool ” & eq2
g2 += 1
ELSE
‘PRINT “Pierde el balon ” & eq2
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
NEXT
juegos[i] = separa[0] & “;” & separa[1] & “;” & separa[2] & “;” & separa[3] & “;” & separa[4] & “;” & separa[5] & “;” & separa[6] & “;” & g1 & “;” & g2 & “;” & -1
‘PRINT eq1;; g1;; eq2;; g2
‘PRINT “————————–0———————–”
NEXT
arch = OPEN Application.Path &/ “Data/partidos.fwc” FOR OUTPUT
FOR i = 0 TO 47
PRINT #arch, juegos[i]
NEXT
arch.Close
arch = OPEN Application.Path &/ “Data/fase2.fwc” FOR OUTPUT
FOR i = 0 TO 7
Fmenu.carga(letras[i])
PRINT #arch, Fmenu.e1 & “;” & 0
PRINT #arch, Fmenu.e2 & “;” & 0
NEXT
arch.Close
juegos.Clear
arch = OPEN Application.Path &/ “Data/fase2.fwc” FOR INPUT
FOR i = 0 TO 15
LINE INPUT #arch, linea
separa = Split(linea, “;”)
juegos.Add(separa[0])
NEXT
arch.Close
FOR i = 0 TO 7
SELECT CASE i
CASE 0
eq1 = juegos[0]
eq2 = juegos[3]
CASE 1
eq1 = juegos[4]
eq2 = juegos[7]
CASE 2
eq1 = juegos[6]
eq2 = juegos[5]
CASE 3
eq1 = juegos[2]
eq2 = juegos[1]
CASE 4
eq1 = juegos[8]
eq2 = juegos[11]
CASE 5
eq1 = juegos[12]
eq2 = juegos[15]
CASE 6
eq1 = juegos[10]
eq2 = juegos[9]
CASE 7
eq1 = juegos[14]
eq2 = juegos[13]
END SELECT
FOR j = 0 TO caract.Count – 1
separa2 = Split(caract[j], “;”)
IF Comp(separa2[0], eq1) = 0 THEN
‘PRINT eq1
‘PRINT separa2[1];; separa2[2];; separa2[3];; separa2[4]
a1 = separa2[1] / 100
d1 = separa2[2] / 100
t1 = separa2[3] / 100
r1 = separa2[4] / 100
f1 = (separa2[1] + separa2[2] + separa2[3] + separa2[4]) / 4 / 100
fg1 = separa2[1] / 90
fd1 = separa2[2] / 90
ENDIF
NEXT
FOR j = 0 TO caract.Count – 1
separa2 = Split(caract[j], “;”)
IF Comp(separa2[0], eq2) = 0 THEN
‘PRINT eq2
‘PRINT separa2[1];; separa2[2];; separa2[3];; separa2[4]
a2 = separa2[1] / 100
d2 = separa2[2] / 100
t2 = separa2[3] / 100
r2 = separa2[4] / 100
f2 = (separa2[1] + separa2[2] + separa2[3] + separa2[4]) / 4 / 100
fg2 = separa2[1] / 90
fd2 = separa2[2] / 90
ENDIF
NEXT
g2 = 0
g1 = 0
FOR t = 0 TO 20
‘PRINT t
comparacion = Rnd()
IF t1 < comparacion THEN
comparacion = Rnd()
IF f1 > comparacion THEN
‘PRINT “Tiene el balon el equipo 1″
comparacion = Rnd()
IF comparacion < a1 THEN
comparacion = Rnd()
‘PRINT “ataque de equipo1″
IF comparacion > d2 THEN
‘PRINT “Peligro por parte del equipo 1″
comparacion = Rnd()
IF comparacion < fg1 THEN
‘PRINT “Disparo a puerta del equipo 1″
comparacion = Rnd()
IF comparacion > fd2 THEN
‘PRINT “goool e1″
g1 += 1
ELSE
‘PRINT “Fallo del equipo1″
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
comparacion = Rnd()
IF t2 < comparacion THEN
comparacion = Rnd()
IF f2 > comparacion THEN
‘PRINT “Tiene el balon el equipo 2″
comparacion = Rnd()
IF comparacion < a2 THEN
comparacion = Rnd()
‘PRINT “ataque de equipo2″
IF comparacion > d1 THEN
‘PRINT “Peligro por parte del equipo 2″
comparacion = Rnd()
IF comparacion < fg2 THEN
‘PRINT “Disparo a puerta del equipo 2″
comparacion = Rnd()
IF comparacion > fd1 THEN
‘PRINT “goool e2″
g2 += 1
ELSE
‘PRINT “Fallo del equipo 2″
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
NEXT
IF g1 = g2 THEN
FOR j = 0 TO 8
comparacion = Rnd()
IF comparacion > r1 THEN
comparacion = Rnd()
IF comparacion > t1 THEN
g1 += 1
ENDIF
ENDIF
comparacion = Rnd()
IF comparacion > r2 THEN
comparacion = Rnd()
IF comparacion > t2 THEN
g2 += 1
ENDIF
ENDIF
NEXT
ENDIF
IF g1 = g2 THEN
IF f1 > f2 THEN
g1 += 1
ELSE
g2 += 1
ENDIF
ENDIF
SELECT CASE i
CASE 0
’49
juegos[0] = eq1 & “;” & g1
juegos[3] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
CASE 1
’50
juegos[4] = eq1 & “;” & g1
juegos[7] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
CASE 2
’51
juegos[6] = eq1 & “;” & g1
juegos[5] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
CASE 3
’52
juegos[2] = eq1 & “;” & g1
juegos[1] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
CASE 4
’53
juegos[8] = eq1 & “;” & g1
juegos[11] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
CASE 5
’54
juegos[12] = eq1 & “;” & g1
juegos[15] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
CASE 6
’55
juegos[10] = eq1 & “;” & g1
juegos[9] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
CASE 7
’56
juegos[14] = eq1 & “;” & g1
juegos[13] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
END SELECT
NEXT
‘cuartos de final
FOR i = 0 TO 3
SELECT CASE i
CASE 0
eq1 = juegos[21]
eq2 = juegos[20]
CASE 1
eq1 = juegos[16]
eq2 = juegos[17]
CASE 2
eq1 = juegos[19]
eq2 = juegos[18]
CASE 3
eq1 = juegos[22]
eq2 = juegos[23]
END SELECT
FOR j = 0 TO caract.Count – 1
separa2 = Split(caract[j], “;”)
IF Comp(separa2[0], eq1) = 0 THEN
‘PRINT separa2[1];; separa2[2];; separa2[3];; separa2[4]
a1 = separa2[1] / 100
d1 = separa2[2] / 100
t1 = separa2[3] / 100
r1 = separa2[4] / 100
f1 = (separa2[1] + separa2[2] + separa2[3] + separa2[4]) / 4 / 100
fg1 = separa2[1] / 90
fd1 = separa2[2] / 90
ENDIF
NEXT
FOR j = 0 TO caract.Count – 1
separa2 = Split(caract[j], “;”)
IF Comp(separa2[0], eq2) = 0 THEN
‘PRINT separa2[1];; separa2[2];; separa2[3];; separa2[4]
a2 = separa2[1] / 100
d2 = separa2[2] / 100
t2 = separa2[3] / 100
r2 = separa2[4] / 100
f2 = (separa2[1] + separa2[2] + separa2[3] + separa2[4]) / 4 / 100
fg2 = separa2[1] / 90
fd2 = separa2[2] / 90
ENDIF
NEXT
g2 = 0
g1 = 0
FOR t = 0 TO 20
‘PRINT t
comparacion = Rnd()
IF t1 < comparacion THEN
comparacion = Rnd()
IF f1 > comparacion THEN
‘PRINT “Tiene el balon el equipo 1″
comparacion = Rnd()
IF comparacion < a1 THEN
comparacion = Rnd()
‘PRINT “ataque de equipo1″
IF comparacion > d2 THEN
‘PRINT “Peligro por parte del equipo 1″
comparacion = Rnd()
IF comparacion < fg1 THEN
‘PRINT “Disparo a puerta del equipo 1″
comparacion = Rnd()
IF comparacion > fd2 THEN
‘PRINT “goool e1″
g1 += 1
ELSE
‘PRINT “Fallo del equipo1″
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
comparacion = Rnd()
IF t2 < comparacion THEN
comparacion = Rnd()
IF f2 > comparacion THEN
‘PRINT “Tiene el balon el equipo 2″
comparacion = Rnd()
IF comparacion < a2 THEN
comparacion = Rnd()
‘PRINT “ataque de equipo2″
IF comparacion > d1 THEN
‘PRINT “Peligro por parte del equipo 2″
comparacion = Rnd()
IF comparacion < fg2 THEN
‘PRINT “Disparo a puerta del equipo 2″
comparacion = Rnd()
IF comparacion > fd1 THEN
‘PRINT “goool e2″
g2 += 1
ELSE
‘PRINT “Fallo del equipo 2″
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
NEXT
IF g1 = g2 THEN
FOR j = 0 TO 8
comparacion = Rnd()
IF comparacion > r1 THEN
comparacion = Rnd()
IF comparacion > t1 THEN
g1 += 1
ENDIF
ENDIF
comparacion = Rnd()
IF comparacion > r2 THEN
comparacion = Rnd()
IF comparacion > t2 THEN
g2 += 1
ENDIF
ENDIF
NEXT
ENDIF
IF g1 = g2 THEN
IF f1 > f2 THEN
g1 += 1
ELSE
g2 += 1
ENDIF
ENDIF
SELECT CASE i
CASE 0
juegos[21] = eq1 & “;” & g1
juegos[20] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
CASE 1
juegos[16] = eq1 & “;” & g1
juegos[17] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
CASE 2
juegos[19] = eq1 & “;” & g1
juegos[18] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
CASE 3
juegos[22] = eq1 & “;” & g1
juegos[23] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
END SELECT
NEXT
‘semifinal
FOR i = 0 TO 1
SELECT CASE i
CASE 0
eq1 = juegos[25]
eq2 = juegos[26]
CASE 1
eq1 = juegos[24]
eq2 = juegos[27]
END SELECT
FOR j = 0 TO caract.Count – 1
separa2 = Split(caract[j], “;”)
IF Comp(separa2[0], eq1) = 0 THEN
‘PRINT separa2[1];; separa2[2];; separa2[3];; separa2[4]
a1 = separa2[1] / 100
d1 = separa2[2] / 100
t1 = separa2[3] / 100
r1 = separa2[4] / 100
f1 = (separa2[1] + separa2[2] + separa2[3] + separa2[4]) / 4 / 100
fg1 = separa2[1] / 90
fd1 = separa2[2] / 90
ENDIF
NEXT
FOR j = 0 TO caract.Count – 1
separa2 = Split(caract[j], “;”)
IF Comp(separa2[0], eq2) = 0 THEN
‘PRINT separa2[1];; separa2[2];; separa2[3];; separa2[4]
a2 = separa2[1] / 100
d2 = separa2[2] / 100
t2 = separa2[3] / 100
r2 = separa2[4] / 100
f2 = (separa2[1] + separa2[2] + separa2[3] + separa2[4]) / 4 / 100
fg2 = separa2[1] / 90
fd2 = separa2[2] / 90
ENDIF
NEXT
g2 = 0
g1 = 0
FOR t = 0 TO 20
‘PRINT t
comparacion = Rnd()
IF t1 < comparacion THEN
comparacion = Rnd()
IF f1 > comparacion THEN
‘PRINT “Tiene el balon el equipo 1″
comparacion = Rnd()
IF comparacion < a1 THEN
comparacion = Rnd()
‘PRINT “ataque de equipo1″
IF comparacion > d2 THEN
‘PRINT “Peligro por parte del equipo 1″
comparacion = Rnd()
IF comparacion < fg1 THEN
‘PRINT “Disparo a puerta del equipo 1″
comparacion = Rnd()
IF comparacion > fd2 THEN
‘PRINT “goool e1″
g1 += 1
ELSE
‘PRINT “Fallo del equipo1″
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
comparacion = Rnd()
IF t2 < comparacion THEN
comparacion = Rnd()
IF f2 > comparacion THEN
‘PRINT “Tiene el balon el equipo 2″
comparacion = Rnd()
IF comparacion < a2 THEN
comparacion = Rnd()
‘PRINT “ataque de equipo2″
IF comparacion > d1 THEN
‘PRINT “Peligro por parte del equipo 2″
comparacion = Rnd()
IF comparacion < fg2 THEN
‘PRINT “Disparo a puerta del equipo 2″
comparacion = Rnd()
IF comparacion > fd1 THEN
‘PRINT “goool e2″
g2 += 1
ELSE
‘PRINT “Fallo del equipo 2″
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
NEXT
IF g1 = g2 THEN
FOR j = 0 TO 8
comparacion = Rnd()
IF comparacion > r1 THEN
comparacion = Rnd()
IF comparacion > t1 THEN
g1 += 1
ENDIF
ENDIF
comparacion = Rnd()
IF comparacion > r2 THEN
comparacion = Rnd()
IF comparacion > t2 THEN
g2 += 1
ENDIF
ENDIF
NEXT
ENDIF
IF g1 = g2 THEN
IF f1 > f2 THEN
g1 += 1
ELSE
g2 += 1
ENDIF
ENDIF
SELECT CASE i
CASE 0
juegos[25] = eq1 & “;” & g1
juegos[26] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
CASE 1
juegos[24] = eq1 & “;” & g1
juegos[27] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
END SELECT
NEXT
‘final
eq1 = juegos[28]
eq2 = juegos[29]
FOR j = 0 TO caract.Count – 1
separa2 = Split(caract[j], “;”)
IF Comp(separa2[0], eq1) = 0 THEN
‘PRINT separa2[1];; separa2[2];; separa2[3];; separa2[4]
a1 = separa2[1] / 100
d1 = separa2[2] / 100
t1 = separa2[3] / 100
r1 = separa2[4] / 100
f1 = (separa2[1] + separa2[2] + separa2[3] + separa2[4]) / 4 / 100
fg1 = separa2[1] / 90
fd1 = separa2[2] / 90
ENDIF
NEXT
FOR j = 0 TO caract.Count – 1
separa2 = Split(caract[j], “;”)
IF Comp(separa2[0], eq2) = 0 THEN
‘PRINT separa2[1];; separa2[2];; separa2[3];; separa2[4]
a2 = separa2[1] / 100
d2 = separa2[2] / 100
t2 = separa2[3] / 100
r2 = separa2[4] / 100
f2 = (separa2[1] + separa2[2] + separa2[3] + separa2[4]) / 4 / 100
fg2 = separa2[1] / 90
fd2 = separa2[2] / 90
ENDIF
NEXT
g2 = 0
g1 = 0
FOR t = 0 TO 20
‘PRINT t
comparacion = Rnd()
IF t1 < comparacion THEN
comparacion = Rnd()
IF f1 > comparacion THEN
‘PRINT “Tiene el balon el equipo 1″
comparacion = Rnd()
IF comparacion < a1 THEN
comparacion = Rnd()
‘PRINT “ataque de equipo1″
IF comparacion > d2 THEN
‘PRINT “Peligro por parte del equipo 1″
comparacion = Rnd()
IF comparacion < fg1 THEN
‘PRINT “Disparo a puerta del equipo 1″
comparacion = Rnd()
IF comparacion > fd2 THEN
‘PRINT “goool e1″
g1 += 1
ELSE
‘PRINT “Fallo del equipo1″
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
comparacion = Rnd()
IF t2 < comparacion THEN
comparacion = Rnd()
IF f2 > comparacion THEN
‘PRINT “Tiene el balon el equipo 2″
comparacion = Rnd()
IF comparacion < a2 THEN
comparacion = Rnd()
‘PRINT “ataque de equipo2″
IF comparacion > d1 THEN
‘PRINT “Peligro por parte del equipo 2″
comparacion = Rnd()
IF comparacion < fg2 THEN
‘PRINT “Disparo a puerta del equipo 2″
comparacion = Rnd()
IF comparacion > fd1 THEN
‘PRINT “goool e2″
g2 += 1
ELSE
‘PRINT “Fallo del equipo 2″
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
NEXT
IF g1 = g2 THEN
FOR j = 0 TO 8
comparacion = Rnd()
IF comparacion > r1 THEN
comparacion = Rnd()
IF comparacion > t1 THEN
g1 += 1
ENDIF
ENDIF
comparacion = Rnd()
IF comparacion > r2 THEN
comparacion = Rnd()
IF comparacion > t2 THEN
g2 += 1
ENDIF
ENDIF
NEXT
ENDIF
IF g1 = g2 THEN
IF f1 > f2 THEN
g1 += 1
ELSE
g2 += 1
ENDIF
ENDIF
juegos[28] = eq1 & “;” & g1
juegos[29] = eq2 & “;” & g2
IF g1 > g2 THEN
juegos.Push(eq1)
ELSE
juegos.Push(eq2)
ENDIF
arch = OPEN Application.Path &/ “Data/fase2.fwc” FOR OUTPUT
FOR i = 0 TO juegos.Count – 1
PRINT #arch, juegos[i]
NEXT
arch.Close
Message.info(“Simulacion Finalizada”)
END

No hay comentarios:

Publicar un comentario