Option Explicit
Sub Main
Dim Es,Fin,R1,A,B,C,D,E1,Clp1,Clp2
Dim P1,P2,P3,P4,P5,Caso,Casi,Ini,Somma
Dim Som1,Som2,Som3,Som4,Som5,Som6
Dim Ambata(1),Ambo1(2),Ambo2(2),Ambo3(2)
Dim Ambo4(2),Ruota(1),Posta(1),Poste(2)
Dim Ruote(1)
Posta(1) = 1
Poste(2) = 1
Fin = EstrazioneFin
Clp1 = InputBox(" Per quanti colpi vuoi giocare l'ambata? ",,6)
Clp2 = InputBox("Per quanti colpi vuoi giocare gli ambi?",,6)
Ini = InputBox("Da quale estrazione vuoi iniziare?",,9500)
Call ScegliRange(Ini,Fin,Ini,EstrazioneFin)
For Es = Ini To Fin
Caso = 0
For R1 = 1 To 12
If R1 = 11 Then R1 = 12
For P1 = 1 To 2
For P2 = P1 + 1 To 3
For P3 = P2 + 1 To 4
For P4 = P3 + 1 To 5
A = Estratto(Es,R1,P1)
B = Estratto(Es,R1,P2)
C = Estratto(Es,R1,P3)
D = Estratto(Es,R1,P4)
Som1 = Fuori90(A + B) : Som2 = Fuori90(C + D)
Som3 = Fuori90(A + C) : Som4 = Fuori90(B + D)
Som5 = Fuori90(A + D) : Som6 = Fuori90(B + C)
If Som1 = Som2 Or Som3 = Som4 Or Som5 = Som6 Then
If Som1 = Som2 Then Somma = Format2(A) & " + " & Format2(B) & " = " & Format2(Som1) & " e " & Format2(C) & " + " & Format2(D) & " = " & Format2(Som2)
If Som3 = Som4 Then Somma = Format2(A) & " + " & Format2(C) & " = " & Format2(Som3) & " e " & Format2(B) & " + " & Format2(D) & " = " & Format2(Som4)
If Som5 = Som6 Then Somma = Format2(A) & " + " & Format2(D) & " = " & Format2(Som5) & " e " & Format2(B) & " + " & Format2(C) & " = " & Format2(Som6)
Caso = Caso + 1
Casi = Casi + 1
ColoreTesto 1
Scrivi String(89,"*") & " Casi Totali " & FormattaStringa(Casi,"0000")
ColoreTesto 2
Scrivi String(80,"*") & " Estrazione " &(Es) & " caso " & FormattaStringa(Caso,"0000")
ColoreTesto 0
Scrivi(" Estrazione n." & Format2(Es) & " del " & DataEstrazione(Es)),1,0
Scrivi " " & SiglaRuota(R1) & " ",1,0
For P5 = 1 To 5
E1 = Estratto(Es,R1,P5)
If E1 = A Or E1 = B Or E1 = C Or E1 = D Then
ColoreTesto 2
Else
ColoreTesto 0
End If
Scrivi Format2(E1) & " ",1,0
ColoreTesto 0
Next
Scrivi
Scrivi
ColoreTesto 2
Scrivi Space(10) & "Somme con il fuori90 " &(Somma),1
ColoreTesto 0
Scrivi
Ruota(1) = R1
Ruote(1) = TT_
If Som1 = Som2 Then
Ambata(1) = Som1
ImpostaGiocata 1,Ambata,Ruota,Posta,Clp1
Ambo1(1) = Som1 : Ambo1(2) = A
ImpostaGiocata 2,Ambo1,Ruote,Poste,Clp2
Ambo2(1) = Som1 : Ambo2(2) = B
ImpostaGiocata 3,Ambo2,Ruote,Poste,Clp2
Ambo3(1) = Som1 : Ambo3(2) = C
ImpostaGiocata 4,Ambo3,Ruote,Poste,Clp2
Ambo4(1) = Som1 : Ambo4(2) = D
ImpostaGiocata 5,Ambo4,Ruote,Poste,Clp2
End If
If Som3 = Som4 Then
Ambata(1) = Som3
ImpostaGiocata 1,Ambata,Ruota,Posta,Clp1
Ambo1(1) = Som3 : Ambo1(2) = A
ImpostaGiocata 2,Ambo1,Ruote,Poste,Clp2
Ambo2(1) = Som3 : Ambo2(2) = B
ImpostaGiocata 3,Ambo2,Ruote,Poste,Clp2
Ambo3(1) = Som3 : Ambo3(2) = C
ImpostaGiocata 4,Ambo3,Ruote,Poste,Clp2
Ambo4(1) = Som3 : Ambo4(2) = D
ImpostaGiocata 5,Ambo4,Ruote,Poste,Clp2
End If
If Som5 = Som6 Then
Ambata(1) = Som5
ImpostaGiocata 1,Ambata,Ruota,Posta,Clp1
Ambo1(1) = Som5 : Ambo1(2) = A
ImpostaGiocata 2,Ambo1,Ruote,Poste,Clp2
Ambo2(1) = Som5 : Ambo2(2) = B
ImpostaGiocata 3,Ambo2,Ruote,Poste,Clp2
Ambo3(1) = Som5 : Ambo3(2) = C
ImpostaGiocata 4,Ambo3,Ruote,Poste,Clp2
Ambo4(1) = Som5 : Ambo4(2) = D
ImpostaGiocata 5,Ambo4,Ruote,Poste,Clp2
End If
Gioca Es
End If
Next
Next
Next
Next
Next
Next
ScriviResoconto
End Sub