Sub Main
Dim A,B,C,D,E,F,Ini,Fin,Es,R,RR,P,PP,Co,S
Dim DistAB,DistAC,DistAD,DistBC,DistBD,DistCD
Dim Dec_A,Dec_B,Dec_C,Dec_D,MaxAB_Distx3,MxAB
Dim DistABx3
Dim ruota(10)
Dim ruote(12)
Dim posta(10)
Dim poste(3)
Dim m(10)
Dim n(10)
Dim n1(10)
Dim n2(10)
Dim n3(10)
Dim n4(10)
Dim n5(10)
'posta(1) = 1
poste(1) = 1
poste(2) = 1
' poste(3) = 1
Co = 0
Fin = EstrazioneFin
Ini = Fin - 1
For Es = Ini To Fin
Messaggio Es
'If IndiceMensile(es) = 10 Then
For R = 1 To 10 '
' If R = 11 Then R = 12
For P = 1 To 4
A = Estratto(Es,R,P)
For PP = P + 1 To 5
B = Estratto(Es,R,PP)
For RR = R + 1 To 12
If RR = 11 Then RR = 12
'For q = 1 To 5
'For qq = q+1 To 5
C = Estratto(Es,RR,P)
D = Estratto(Es,RR,PP)
'c1= Estratto(es,r,p)
'condizione 1
If(C <> A And C <> B And D <> A And D <> B) Then
'Queste 3 righe le ho aggiunte per non ripetere sempre le funzioni Distanze e Decine
DistAB = Distanza(A,B) : DistAC = Distanza(A,C) : DistAD = Distanza(A,D)
DistBC = Distanza(B,C) : DistBD = Distanza(B,D) : DistCD = Distanza(C,D)
Dec_A = Decina(A) : Dec_B = Decina(B) : Dec_C = Decina(C) : Dec_D = Decina(D)
S = ""
If DistAB = 30 Xor DistAC = 30 Xor DistAD = 30 Xor DistBC = 30 Xor DistBD = 30 Xor DistCD = 30 Then
If DistAB = 30 Then
S = " La Distanza tra " &(A) & " e " &(B) & " = 30"
If Dec_A = Dec_C Then
E = Fuori90(C + 30)
'----------------
Call DistanzaAB(A,B,F)
End If
'condizione 2
If Dec_A = Dec_D Then
E = Fuori90(D + 30)
Call DistanzaAB(A,B,F)
End If
'condizione 3
If Dec_B = Dec_C Then
E = Fuori90(C + 30)
Call DistanzaAB(A,B,F)
End If
'condizione 4
If Dec_B = Dec_D Then
E = Fuori90(D + 30)
Call DistanzaAB(A,B,F)
End If
End If
'*********************************************************
'*********************************************************
'condizione 5
If DistAC = 30 Then
S = " La Distanza tra " &(A) & " e " &(C) & " = 30"
If Dec_A = Dec_B Then
E = Fuori90(B + 30)
Call DistanzaAC(A,C,F)
End If
'condizione 6
If Dec_A = Dec_D Then
E = Fuori90(D + 30)
Call DistanzaAC(A,C,F)
End If
'condizione 7
If Dec_C = Dec_B Then
E = Fuori90(B + 30)
Call DistanzaAC(A,C,F)
End If
'condizione 8
If Dec_C = Dec_D Then
E = Fuori90(D + 30)
Call DistanzaAC(A,C,F)
End If
End If
'*********************************************************
'*********************************************************
'condizione 9
If DistAD = 30 Then
S = " Distanza tra " &(A) & " e " &(D) & " = 30"
If Dec_A = Dec_C Then
E = Fuori90(C + 30)
Call DistanzaAD(A,D,F)
End If
'condizione 10
If Dec_A = Dec_B Then
E = Fuori90(B + 30)
Call DistanzaAD(A,D,F)
End If
'condizione 11
If Dec_D = Dec_C Then
E = Fuori90(C + 30)
Call DistanzaAD(A,D,F)
End If
'condizione 12
If Dec_D = Dec_B Then
E = Fuori90(D + 30)
Call DistanzaAD(A,D,F)
End If
End If
'*********************************************************
'*********************************************************
'condizione 13
If DistCD = 30 Then
S = " Distanza tra " &(C) & " e " &(D) & " = 30"
If Dec_C = Dec_A Then
E = Fuori90(A + 30)
Call DistanzaCD(C,D,F)
End If
'condizione 14
If Dec_C = Dec_B Then
E = Fuori90(B + 30)
Call DistanzaCD(C,D,F)
End If
'condizione 15
If Dec_D = Dec_A Then
E = Fuori90(A + 30)
Call DistanzaCD(C,D,F)
End If
'condizione 16
If Dec_D = Dec_B Then
E = Fuori90(B + 30)
Call DistanzaCD(C,D,F)
End If
End If
'*********************************************************
'*********************************************************
'condizione 17
If DistBC = 30 Then
S = " Distanza tra " &(B) & " e " &(C) & " = 30"
If Dec_B = Dec_A Then
E = Fuori90(A + 30)
Call DistanzaBC(B,C,F)
End If
'condizione 18
If Dec_B = Dec_D Then
E = Fuori90(D + 30)
Call DistanzaBC(B,C,F)
End If
' condizione 19
If Dec_C = Dec_A Then
E = Fuori90(A + 30)
Call DistanzaBC(B,C,F)
End If
'condizione 20
If Dec_C = Dec_D Then
E = Fuori90(D + 30)
Call DistanzaBC(B,C,F)
End If
End If
'*********************************************************
'*********************************************************
'le ultime 4 condizioni sono state aggiunte da Salvo50
'condizione 21
If DistBD = 30 Then
S = " La Distanza tra " &(B) & " e " &(D) & " = 30"
If Dec_B = Dec_A Then
E = Fuori90(A + 30)
Call DistanzaBD(B,D,F)
End If
'condizione 22
If Dec_B = Dec_C Then
E = Fuori90(C + 30)
Call DistanzaBD(B,D,F)
End If
'
'condizione 23
If Dec_D = Dec_A Then
E = Fuori90(A + 30)
Call DistanzaBD(B,D,F)
End If
'condizione 24
If Dec_D = Dec_C Then
E = Fuori90(C + 30)
Call DistanzaBD(B,D,F)
End If
End If
MxAB = Massimo(A,B) : DistABx3 = Fuori90(DistAB * 3)
MaxAB_Distx3 = Fuori90((MxAB) +(DistABx3))
'*********************************************************
'*********************************************************
Co = Co + 1
ruota(1) = R
ruota(2) = RR
Scrivi
Scrivi
Scrivi String(90,"*") & " Caso " & Co
Scrivi DataEstrazione(Es,1),1
Scrivi
Scrivi S,1,,,2
Scrivi
ColoreTesto 1 :
Scrivi "< " & "" & SiglaRuota(R) & " " & StringaEstratti(Es,R) & " > 1°numero = ",1,0
Scrivi Format2(A) & " > 2°numero = " & Format2(B) & " massimo A,B " & Massimo(A,B),1,0
Scrivi " distanza(A,B)" & Distanza(A,B),1
Scrivi "< " & "" & SiglaRuota(RR) & " " & StringaEstratti(Es,RR) & " > 3°numero = " & Format2(C),1,0
Scrivi " > 4°numero = " & Format2(D) & " Massimo A,B " & MxAB & " + Distanza A,B ",1,0
Scrivi "(" & DistAB & " * 3) = " & MaxAB_Distx3,1
Scrivi String(90,"-")
n1(1) = E
n1(2) = F
n1(3) = Fuori90(E - 27)
ImpostaGiocata 1,n1,ruota,poste,9,2
Gioca Es,,,1
End If
End If
Next
Next
Next
Next
Next
Scrivi
Scrivi String(65,"•")
ColoreTesto 2 : Scrivi "casi trovati : " & Co,1
ColoreTesto 0 : Scrivi String(65,"•")
ScriviResoconto
ColoreTesto 1 : Scrivi "",1
End Sub
Function DistanzaAB(A,B,F)
If Fuori90(A + 30) = B Then
F = Fuori90(A + 60)
Else
F = Fuori90(A + 30)
End If
End Function
Function DistanzaAC(A,C,F)
If Fuori90(A + 30) = C Then
F = Fuori90(A + 60)
Else
F = Fuori90(A + 30)
End If
End Function
Function DistanzaAD(A,D,F)
If Fuori90(A + 30) = D Then
F = Fuori90(A + 60)
Else
F = Fuori90(A + 30)
End If
End Function
Function DistanzaCD(C,D,F)
If Fuori90(C + 30) = D Then
F = Fuori90(C + 60)
Else
F = Fuori90(C + 30)
End If
End Function
Function DistanzaBC(B,C,F)
If Fuori90(C + 30) = B Then
F = Fuori90(C + 60)
Else
F = Fuori90(C + 30)
End If
End Function
Function DistanzaBD(B,D,F)
If Fuori90(B + 30) = D Then
F = Fuori90(B + 60)
Else
F = Fuori90(B + 30)
End If
End Function