Novità

ho tradotto questo script

L

LuigiB

Guest
Ciao a tutti , mi è arrivata poco fa una mail dove un utente chiedeva se potessi convertire uno script fatto per non so quale programa in un formato idoneo a lottodesk o a spaziometria ..

La cosa era piuttosto semplice e a beneficio di tutti posto lo script funzionante in spaziometria.
poi posto il codice originale.


P.S.
Che nessuno si faccia venire in mente di mandarmi altri script da convertire ... io quello che potevo fare cercando di insegnare l'ho fatto...



Codice:
'SCRIPT DI ESEMPIO PER TROVARE LE FORMAZIONI SUPERFREQUENTI
'LAVORA SOLO SU RUOTA SINGOLA O TUTTE
'PER RENDERLO COMPATIBILE CON ALTRI SOFTWARE E' SUFFICIENTE CAMBIARE ALCUNE ISTRUZIONI
'VARIABILI GLOBALI
Dim Freq(90)
Dim Num(90)
Dim DataIni,DataFin
Dim Ciclo,TotCicli,Sorte,Ruota,FreqMin
Dim R1,R2,R3,R4,ruota1,ruota2,ruota3,ruota4,fine
Sub Main()
	Ciclo = CInt(InputBox("Durata del ciclo",,10))
	TotCicli = CInt(InputBox("Cicli totali",,6))
	FreqMin = CInt(InputBox("Frequenze minime dei singoli numeri per ciclo",,2))
	Sorte = CInt(InputBox("Sorte di ricerca" + Chr(13) + "1=estratto; 2=ambo; 3=terno; 4=quat; 5=cinq",,2))
	ruota1 = CInt(InputBox("Ruota di ricerca 1" + Chr(13) + "1=BA...10=VE; 11=NAZ; 11=TUTTE",,4))
	ruota2 = CInt(InputBox("Ruota di ricerca 2" + Chr(13) + "1=BA...10=VE; 11=NAZ; 11=TUTTE",,5))
	ruota3 = CInt(InputBox("Ruota di ricerca 3" + Chr(13) + "1=BA...10=VE; 11=NAZ; 11=TUTTE",,9))
	ruota4 = CInt(InputBox("Ruota di ricerca 4" + Chr(13) + "1=BA...10=VE; 11=NAZ; 11=TUTTE",,10))
	fine = InputBox("Estrazione finale",,EstrazioniArchivio)
	If Ruota <> 11 Then
		R1 = ruota1
		R2 = ruota2
		R3 = ruota3
		R4 = ruota4
	Else
		R1 = 1
		R2 = 10
	End If
	DataFin = fine
	DataIni = DataFin -(Ciclo*TotCicli)
	CalcolaFrequenze()
	OrdinaFrequenze()
	TrovaFormazione()
End Sub
Sub CalcolaFrequenze()
	Dim a,e,n,r
	For a = DataIni To DataFin
		For r = R1 To R2
			For e = 1 To 5
				n = Estratto(a,r,e)
				Freq(n) = Freq(n) + 1
			Next
		Next
	Next
End Sub
Sub OrdinaFrequenze()
	Dim a,b,k
	For a = 1 To 90
		Num(a) = a
	Next
	For a = 1 To 89
		For b = a + 1 To 90
			If Freq(a) < Freq(b) Then
				k = Freq(a)
				Freq(a) = Freq(b)
				Freq(b) = k
				k = Num(a)
				Num(a) = Num(b)
				Num(b) = k
			End If
		Next
	Next
End Sub
Sub TrovaFormazione()
	Dim t
	Dim numForm()
	Dim numRichiesti
	numRichiesti = 0
	For t = 1 To 90
		ReDim numForm(90)
		If Verifica(t) = True Then
			numRichiesti = t
			Exit For
		End If
	Next
	Dim strNum
	For t = 1 To numRichiesti
		strNum = strNum & Num(t) & "."
	Next
	If Right(strNum,1) = "." Then strNum = Left(strNum,Len(strNum) - 1)
	Call Scrivi("SuperFrequenze")
	Call Scrivi
	Call Scrivi("Data iniziale: " & GetInfoEstrazione(DataFin -(Ciclo*TotCicli)))
	Call Scrivi("Data finale:   " & GetInfoEstrazione(DataFin))
	Call Scrivi("Ruota/e: " & SiglaRuota(R1) & "-" & SiglaRuota(R2) & "-" & SiglaRuota(R3) & "-" & SiglaRuota(R4))
	Call Scrivi("Durata ciclo: " & Ciclo)
	Call Scrivi("Cicli totali: " & TotCicli)
	Call Scrivi("Frequenze min. dei singoli numeri per ciclo: " & FreqMin)
	Call Scrivi("Sorte di ricerca: " & NomeSorte(Sorte))
	Scrivi
	Call Scrivi("Formazione trovata (" & numRichiesti & " NR):",True)
	Call Scrivi(strNum,,,,Rosso_)
End Sub
Function Verifica(totNum)
	Dim a,b,c,e,n,k,r
	Dim esatti
	Dim fr
	k = DataIni
	For c = 1 To TotCicli
		fr = 0
		For r = R1 To R4
			For a = 0 To(Ciclo - 1)
				esatti = 0
				For e = 1 To 5
					n = Estratto(k + a,r,e)
					esatti = esatti + ControllaFormazione(n,totNum)
				Next
				If esatti >= Sorte Then
					fr = fr + Combinazioni(esatti,Sorte)
				End If
			Next
		Next
		If fr < FreqMin Then 
			Verifica =  False
			Exit Function 
		End If
		k = k + Ciclo
	Next
	Verifica = True
End Function
Function ControllaFormazione(n,tot)
	Dim a
	For a = 1 To tot
		If Num(a) = n Then
			ControllaFormazione = 1
			Exit Function
		End If
	Next
	ControllaFormazione = 0
End Function




vecchio codice utile solo per studio a chi interessa

Codice:
'SCRIPT DI ESEMPIO PER TROVARE LE FORMAZIONI SUPERFREQUENTI
'LAVORA SOLO SU RUOTA SINGOLA O TUTTE
'PER RENDERLO COMPATIBILE CON ALTRI SOFTWARE E' SUFFICIENTE CAMBIARE ALCUNE ISTRUZIONI


'VARIABILI GLOBALI
public Freq(90) as integer
public Num(90) as integer
public DataIni, DataFin as integer
public Ciclo, TotCicli, Sorte, Ruota, FreqMin as integer
public R1, R2, R3, R4 as integer,ruota1,ruota2,ruota3,ruota4,fine


Sub Main()
    
    Ciclo = CINT(InputBox("Durata del ciclo",,10))
    TotCicli = CINT(InputBox("Cicli totali",,6))
    FreqMin = CINT(InputBox("Frequenze minime dei singoli numeri per ciclo",,2))
    Sorte = CINT(InputBox("Sorte di ricerca" + chr(13) + "1=estratto; 2=ambo; 3=terno; 4=quat; 5=cinq",,2))
    Ruota1 = CINT(InputBox("Ruota di ricerca 1" + chr(13) + "1=BA...10=VE; 11=NAZ; 12=TUTTE",,4))
    Ruota2 = CINT(InputBox("Ruota di ricerca 2" + chr(13) + "1=BA...10=VE; 11=NAZ; 12=TUTTE",,5))
    Ruota3 = CINT(InputBox("Ruota di ricerca 3" + chr(13) + "1=BA...10=VE; 11=NAZ; 12=TUTTE",,9))
    Ruota4 = CINT(InputBox("Ruota di ricerca 4" + chr(13) + "1=BA...10=VE; 11=NAZ; 12=TUTTE",,10))
    fine = inputbox("Estrazione finale",,Estrazione.Ultima)
    
    if Ruota <> 12 then
        R1 = Ruota1
        R2 = Ruota2
        R3 = Ruota3
        R4 = Ruota4
    else
        R1 = 1
        R2 = 10
    end if
    
  
    DataFin= fine
    DataIni = DataFin-(Ciclo*TotCicli)
    
    CalcolaFrequenze()
    OrdinaFrequenze()
    
    TrovaFormazione()
    
End Sub


Sub CalcolaFrequenze()
    
    dim a,e,n,r as integer
    
    for a = DataIni to DataFin
        for r = R1 to R2
            for e = 1 to 5
                n = Estratti.Numero(a,r,e)
                Freq(n) = Freq(n)+1
            next        
        next
    next
    
    
End Sub

Sub OrdinaFrequenze()
    
    dim a,b,k as integer
    
    for a = 1 to 90
        Num(a) = a
    next
    
    for a = 1 to 89
        for b = a+1 to 90
            if Freq(a) < Freq(b) Then
                k = Freq(a)
                Freq(a) = Freq(b)
                Freq(b) = k
                k = Num(a)
                Num(a) = Num(b)
                Num(b) = k       
            end if
        next
    next
    
    
End Sub

Sub TrovaFormazione()
    
    dim t as integer
    dim numForm() as integer
    dim numRichiesti as integer=0
    
    for t = 1 to 90
        redim numForm(90)
        if Verifica(t) = true Then
            numRichiesti = t
            exit for
        end if
    next
    
    dim strNum as string = ""
    for t = 1 to numRichiesti
        strNum = strNum & Num(t) & "."
    next    
    if Right(strNum,1) = "." then strNum = Left(strNum,Len(strNum)-1)
    
    Testo.Out("SuperFrequenze")
    Testo.Out
    Testo.Out("Data iniziale: " & Estrazione.Data(DataFin-(Ciclo*TotCicli)))
    Testo.Out("Data finale:   " & Estrazione.Data(DataFin))
    Testo.Out("Ruota/e: " & SiglaRuota(R1)&"-"& siglaruota(r2)&"-"& siglaruota(r3)&"-"& siglaruota(r4))
    Testo.Out("Durata ciclo: " & Ciclo)
    Testo.Out("Cicli totali: " & TotCicli)
    Testo.Out("Frequenze min. dei singoli numeri per ciclo: " & FreqMin)
    Testo.Out("Sorte di ricerca: " & SorteTestuale(Sorte))
    Testo.Out
    Testo.Out("Formazione trovata (" & numRichiesti & " NR):",_GRASSETTO)
    Testo.TitoloH2(strNum,_ROSSO)
    
End Sub

Function Verifica(totNum as integer) as boolean
    
    dim a,b,c,e,n,k,r as integer
    dim esatti as integer
    dim fr as integer
    
    k = DataIni
    for c = 1 to TotCicli
        fr = 0
        for r=R1 to R4
            for a = 0 to (Ciclo-1)
                esatti = 0
                for e = 1 to 5
                    n = Estratti.Numero(k+a,r,e)
                    esatti = esatti + ControllaFormazione(n,totNum)
                next
                if esatti >= Sorte then 
                    fr = fr + Combinazioni(esatti,Sorte)
                end if
            next
        Next
        if fr < FreqMin then return false
        k = k + Ciclo
    next
    
    return true
    
End Function


Function ControllaFormazione(n as integer, tot as integer) as integer
    
    dim a as integer
    
    for a = 1 to tot
        if Num(a) = n then return 1
    next
    
    return 0
    
End Function
 

Ultima estrazione Lotto

  • Estrazione del lotto
    martedì 23 aprile 2024
    Bari
    47
    22
    34
    20
    50
    Cagliari
    33
    14
    86
    02
    62
    Firenze
    61
    22
    44
    19
    26
    Genova
    21
    12
    57
    82
    55
    Milano
    66
    05
    11
    70
    30
    Napoli
    05
    23
    25
    52
    73
    Palermo
    23
    44
    49
    71
    65
    Roma
    82
    37
    59
    34
    71
    Torino
    26
    42
    66
    15
    58
    Venezia
    57
    06
    68
    54
    84
    Nazionale
    21
    79
    49
    03
    01
    Estrazione Simbolotto
    Genova
    24
    02
    19
    03
    27

Ultimi Messaggi

Alto