Option Explicit
Sub Main()
Dim r, Sorte, sSorte, sNomeSorte
Dim nEstr, Ini, Fin
Dim k, j, sTmp, aStr
Dim aNum(), aRuote(1)
Dim Rit, RitMax, IncrRitMax, Freq
Dim bRitMaxZeroSeAssente
Dim aCinquine(17)
Dim aTitoli(5), aValori(5)
' Imposta a True per avere 142/0 quando Freq = 0, a False per avere 142/142
bRitMaxZeroSeAssente = True
' Scelta Ruota (se si chiude la finestra senza scegliere, usa Milano)
r = ScegliRuota
If r = 0 Then r = MI_
' Scelta Sorte (default 2 = Ambo)
sSorte = InputBox("Inserisci la sorte:" & vbCrLf & "1 = Estratto | 2 = Ambo | 3 = Terno | 4 = Quaterna | 5 = Cinquina", "Scelta Sorte", "2")
If Trim(sSorte) = "" Then Exit Sub
Sorte = CInt(sSorte)
sNomeSorte = "Sorte " & Sorte
If Sorte = 1 Then sNomeSorte = "Estratto"
If Sorte = 2 Then sNomeSorte = "Ambo"
If Sorte = 3 Then sNomeSorte = "Terno"
If Sorte = 4 Then sNomeSorte = "Quaterna"
If Sorte = 5 Then sNomeSorte = "Cinquina"
' Range mobile sulle ultime 142 estrazioni
nEstr = 142
Fin = EstrazioneFin
Ini = Fin - nEstr + 1
If Ini < 1 Then Ini = 1
aRuote(1) = r
' Gruppo delle 17 cinquine
aCinquine(1) = "2 3 5 8 12"
aCinquine(2) = "2 3 13 19 21"
aCinquine(3) = "5 8 13 25 26"
aCinquine(4) = "12 13 34 37 43"
aCinquine(5) = "2 3 25 34 44"
aCinquine(6) = "5 8 19 34 45"
aCinquine(7) = "2 3 26 37 45"
aCinquine(8) = "5 8 21 37 44"
aCinquine(9) = "12 13 44 45 46"
aCinquine(10) = "2 3 43 46 59"
aCinquine(11) = "5 8 43 71 72"
aCinquine(12) = "12 13 59 71 80"
aCinquine(13) = "2 3 71 72 80"
aCinquine(14) = "5 8 46 59 80"
aCinquine(15) = "12 19 21 25 72"
aCinquine(16) = "12 13 26 34 72"
aCinquine(17) = "19 26 43 44 80"
Call Scrivi("Ruota: " & NomeRuota(r) & " (" & SiglaRuota(r) & ") | Sorte: " & sNomeSorte, 1)
Call Scrivi("Periodo analizzato: ultime " & (Fin - Ini + 1) & " estrazioni (dal n." & Ini & " al n." & Fin & " del " & DataEstrazione(Fin) & ")", 1)
Call Scrivi(String(70, "-"))
aTitoli(1) = "N°"
aTitoli(2) = "Cinquina"
aTitoli(3) = "Rit"
aTitoli(4) = "RitMax"
aTitoli(5) = "Freq"
Call InitTabella(aTitoli)
For k = 1 To UBound(aCinquine)
sTmp = Trim(aCinquine(k))
sTmp = Replace(sTmp, ".", " ")
sTmp = Replace(sTmp, "-", " ")
sTmp = Replace(sTmp, ",", " ")
Do While InStr(sTmp, " ") > 0
sTmp = Replace(sTmp, " ", " ")
Loop
If sTmp <> "" Then
aStr = Split(sTmp, " ")
ReDim aNum(UBound(aStr))
For j = 0 To UBound(aStr)
aNum(j) = CInt(aStr(j))
Next
Rit = 0
RitMax = 0
IncrRitMax = 0
Freq = 0
Call StatisticaFormazioneTurbo(aNum, aRuote, Sorte, Rit, RitMax, IncrRitMax, Freq, Ini, Fin)
If bRitMaxZeroSeAssente = True Then
If Freq = 0 Then RitMax = 0
End If
Call Scrivi(Right("0" & k, 2) & ") " & sTmp & " --> Rit " & Rit & " / rmax " & RitMax & " (Freq: " & Freq & ")")
aValori(1) = k
aValori(2) = sTmp
aValori(3) = Rit
aValori(4) = RitMax
aValori(5) = Freq
Call AddRigaTabella(aValori)
End If
Next
Call Scrivi("")
Call CreaTabella()
End Sub