'Chiesto da Juri
'Vorrei sapere,per piacere,se si riesce a fare uno script stessa estrazione con es:
'Il 21 luglio su fi 55-65 e su ro 70-75.Come vedete c'è la distanza 5 tra 55-65-70-75 ma manca il 60.
'Poi altro esempio: su mi 71-73 e su ro 75-72.Qui 71-72-73-75 ma manca il 74.Si può fare con ogni Distanza?
'Va bene In ogni Posizione e su 2 ruote.Anche 3 numeri su 1 ruota e 1 sull'altra.Meglio 2 e 2.
'script by Salvo50
Option Explicit
Sub Main()
   Dim R1,R2,P1,P2,P3,P4,P5,P6,A,B,C,D
   Dim DZ12,DZ23,DZ34,E1,E2,X,Clp,Salvo50
   Dim Es,Ini,Fin,Nu,D2,Caso,Casi
   Dim Am(1),Z(4)
   Dim Ruote(2),Posta(1)
   Posta(1) = 1
   Fin = EstrazioneFin
   Ini = 9500
   Clp = CInt(InputBox(" Per quanti colpi vuoi giocare le ambate ? ",Salvo50,7))
   Call ScegliRange(Ini,Fin,Ini,Fin)
   For Es = Ini To Fin
      Caso = 0
      Messaggio "Estrazione esaminata: " & CStr(Es)
      AvanzamentoElab Ini,Fin,Es
      For R1 = 1 To 10
         For P1 = 1 To 4
            For P2 = P1 + 1 To 5
               A = Estratto(Es,R1,P1)
               B = Estratto(Es,R1,P2)
               For R2 = R1 + 1 To 12
                  If R2 = 11 Then R2 = 12
                  For P3 = 1 To 4
                     For P4 = P3 + 1 To 5
                        C = Estratto(Es,R2,P3)
                        D = Estratto(Es,R2,P4)
                        If A <> C And A <> D And B <> C And B <> D Then
                           Z(1) = A : Z(2) = B : Z(3) = C : Z(4) = D
                           Call OrdinaMatrice(Z,1)
                           DZ12 = Differenza(Z(1),Z(2))
                           DZ23 = Differenza(Z(2),Z(3))
                           DZ34 = Differenza(Z(3),Z(4))
                           For X = 1 To 22
                              If(DZ12 = X And DZ23 = X And DZ34 =(X * 2)) Xor(DZ12 = X And DZ34 = X And DZ23 =(X * 2))_
                                 Xor(DZ23 = X And DZ34 = X And DZ12 =(X * 2))Xor(DZ23 = X And DZ34 = X And DZ12 = X) Then
                                 If DZ12 =(X * 2) Then Nu = Z(1) + X
                                 If DZ23 =(X * 2) Then Nu = Z(2) + X
                                 If DZ34 =(X * 2) Then Nu = Z(3) + X
                                 If(DZ23 = X And DZ34 = X And DZ12 = X) Then Nu = Fuori90(Z(4) + X)
                                 Caso = Caso + 1
                                 Casi = Casi + 1
                                 ColoreTesto 1
                                 Scrivi String(89,"o") & " Casi Totali " & FormattaStringa(Casi,"0000")
                                 ColoreTesto 2
                                 Scrivi String(80,"o") & " Estrazione " &(Es) & " caso " & FormattaStringa(Caso,"0000")
                                 ColoreTesto 0
                                 Scrivi
                                 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 Then
                                       Call ColoreTesto(2)
                                    Else
                                       Call ColoreTesto(0)
                                    End If
                                    Call Scrivi(Format2(E1) & " ",1,0)
                                    Call ColoreTesto(0)
                                 Next
                                 Scrivi
                                 Scrivi(" Estrazione n." & Format2(Es) & " del " & DataEstrazione(Es)),1,0
                                 Scrivi "  " & SiglaRuota(R2) & " ",1,0
                                 For P6 = 1 To 5
                                    E2 = Estratto(Es,R2,P6)
                                    If E2 = C Or E2 = D Then
                                       Call ColoreTesto(2)
                                    Else
                                       Call ColoreTesto(0)
                                    End If
                                    Call Scrivi(Format2(E2) & " ",1,0)
                                    Call ColoreTesto(0)
                                 Next
                                 Scrivi "  Differenza " & Format2(X) & "  Mancante ",1,0
                                 ColoreTesto 2
                                 Scrivi Format2(Nu)
                                 ColoreTesto 0
                                 Ruote(1) = R1
                                 Ruote(2) = R2
                                 Am(1) = Nu
                                 Scrivi
                                 ImpostaGiocata 1,Am,Ruote,Posta,Clp,1
                                 Gioca Es
                              End If
                              If ScriptInterrotto Then Exit Sub
                           Next
                        End If
                     Next
                  Next
               Next
            Next
         Next
      Next
      If ScriptInterrotto Then Exit Sub
   Next
   ScriviResoconto
   Scrivi TempoTrascorso
End Sub