Novità

Aiuto x uno script

bonalele

Member
Buonasera a tutti avrei bisogno di qualche bravo programmatore per un quesito legato a un mio script. Io sono molto scarso a programmare e voorei se possibile un consiglio da Voi.
Come faccio in un listato a dire di eseguire una condizione If oppure un'altra condizione if:

Condizione 1
If Distanza(b,c) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

Condizione 2
If Distanza(b,c) = 30 And Decina(c) = Decina(a) Then
e = Fuori90(a + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

Come faccio a far fare al programma entrambe le condizioni, perchè così come scritto non ne fa neanche una
Spero di essermi spiegato, grazie mille x le Vs risposte o suggerimenti

Raffaele
 
Buonasera a tutti avrei bisogno di qualche bravo programmatore per un quesito legato a un mio script. Io sono molto scarso a programmare e voorei se possibile un consiglio da Voi.
Come faccio in un listato a dire di eseguire una condizione If oppure un'altra condizione if:

Condizione 1
If Distanza(b,c) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

Condizione 2
If Distanza(b,c) = 30 And Decina(c) = Decina(a) Then
e = Fuori90(a + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

Come faccio a far fare al programma entrambe le condizioni, perchè così come scritto non ne fa neanche una
Spero di essermi spiegato, grazie mille x le Vs risposte o suggerimenti

Raffaele
Ciao a Tutti

Ho confuso lucciole con lanterne
rifaccio tutto
 
Ultima modifica:
Buongiorno Salvo,
scusa ma le condizioni non sono uguali:

Condizione 1
If Distanza(b,c) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)

Condizione 2
If Distanza(b,c) = 30 And Decina(c) = Decina(a) Then
e = Fuori90(a + 30)

il resto del calcolo e' uguale...
 
Buongiorno Salvo,
scusa ma le condizioni non sono uguali:

Condizione 1
If Distanza(b,c) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)

Condizione 2
If Distanza(b,c) = 30 And Decina(c) = Decina(a) Then
e = Fuori90(a + 30)

il resto del calcolo e' uguale...
Grazie mi sembravano uguali, provvedo a cambiarlo
 
Ancora grazie a Druid che mi ha fatto notare il mio errore :) (diamo la colpa all'età 75 anni)

Allora iniziamo da capo, ho preso un mio script ho tolto i vecchi calcoli e al loro posto ho messo
le 2 condizioni, ho messo dei commenti, per far capire cosa ho fatto.
In uscita ho messo 2 scrivi
i numeri di sopra sono il risultato della prima condizione
quelli di sotto sono il risultato della seconda condizione

Io in questi casi faccio così, se si può migliorare e ben accetto

Codice:
Option Explicit
Sub Main
   Dim FIn,Ini,A,B,C,D,E,F,G,H,Es,Salvo50
   Dim R1,R2,P1,P2,P3,P4,P5,P6,E1,E2,Caso,Casi
   FIn = EstrazioneFin
   Ini = CInt(InputBox("Inserisci l'estrazione che vuoi iniziare",Salvo50,10690))
   Call ScegliRange(Ini,FIn,Ini,FIn)
   For Es = Ini To FIn
      Messaggio Es
      AvanzamentoElab Ini,FIn,Es
      Caso = 0
      For R1 = 1 To 9
         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 10
                  For P3 = 1 To 4
                     For P4 = P3 + 1 To 5
                        C = Estratto(Es,R2,P3)
                        D = Estratto(Es,R2,P4)
                        If A > 0 And C > 0 Then
                           If A <> C And A <> D And B <> C And B <> D Then
                              'A--B
                              '|  |
                              'C--D
                              'Condizione 1 e 2 devono essere eseguite insieme
                              If(Distanza(B,C) = 30 And Decina(B) = Decina(D)) And (Distanza(B,C) = 30 And Decina(C) = Decina(A)) Then
                                 'Condizione 1
                                 E = Fuori90(D + 30)
                                 If Fuori90(C + 30) = B Then
                                    F = Fuori90(C + 60)
                                 Else
                                    F = Fuori90(C + 30)
                                 End If
                                 'Condizione 2
                                 G = Fuori90(A + 30)
                                 If Fuori90(C + 30) = B Then
                                    H = Fuori90(C + 60)
                                 Else
                                    H = Fuori90(C + 30)
                                 End If
                                 ' End If
                                 Caso = Caso + 1
                                 Casi = Casi + 1
                                 Scrivi String(89,"*") & " Casi Totali " & FormattaStringa(Casi,"0000"),1,,,2
                                 Scrivi String(80,"*") & " Estrazione " &(Es) & " caso " & FormattaStringa(Caso,"0000"),1,,,1
                                 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
                                       ColoreTesto 2
                                    Else
                                       ColoreTesto 0
                                    End If
                                    Scrivi Format2(E1) & " ",1,0
                                    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
                                       ColoreTesto 2
                                    Else
                                       ColoreTesto 0
                                    End If
                                    Scrivi Format2(E2) & " ",1,0
                                    ColoreTesto 0
                                 Next
                                 Scrivi
                               Scrivi Format2(E) & " " & Format2(F),1
                              Scrivi Format2(G) & " " & Format2(H),1
                              End If
                           End If
                        End If
                     Next
                  Next
               Next
            Next
         Next
      Next
      If ScriptInterrotto Then Exit Sub
   Next
End Sub
 
Ultima modifica:
Un chiarimento, ho supposto che le condizioni ci devono essere tutti e 2
e quindi nel primo IF ho messo And.

Ma se invece vuol dire che ci può essere o la 1a condizione oppure la 2a
quell'And deve essere modificato in Or ed inserire per ogni condizione
la sua condizione.

In data 11-08
Lo script è da riprendere mi sono accorto che alcune righe erano inutili
 
Ultima modifica:
Un chiarimento, ho supposto che le condizioni ci devono essere tutti e 2
e quindi nel primo IF ho messo And.

Ma se invece vuol dire che ci può essere o la 1a condizione oppure la 2a
quell'And deve essere modificato in Or ed inserire per ogni condizione
la sua condizione.

In data 11-08
Lo script è da riprendere mi sono accorto che alcune righe erano inutili
Buongiorno grazie mille per le risposte. Devo capire le modifiche, sono solo alle prime armi.
Metto l'intero script x capire se è modificabile.
Le condizioni posso essere solo una
Grazie
Raffaele
 
Ecco lo script completo:

Sub Main
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
'posta(2) = 1
poste(2) = 1
poste(3) = 1
co = 0

fin = EstrazioneFin
ini = fin - 20
For es = ini To fin

'If IndiceMensile(es) = 10 Then
For r = 1 To 12
If r = 11 Then r = 12
For p = 1 To 5
a = Estratto(es,r,p)
For pp = p + 1 To 5
b = Estratto(es,r,pp)
For rr = 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)
If(c <> a And c <> b And d <> a And d <> b) Then

If Distanza(a,b) = 30 And Decina(a) = Decina(c) Then
e = Fuori90(c + 30)
If Fuori90(a + 30) = b Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If


If Distanza(a,b) = 30 And Decina(a) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(a + 30) = b Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,b) = 30 And Decina(b) = Decina(c) Then
e = Fuori90(c + 30)
If Fuori90(a + 30) = b Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,b) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(a + 30) = b Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,c) = 30 And Decina(a) = Decina(b) Then
e = Fuori90(b + 30)
If Fuori90(a + 30) = c Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,c) = 30 And Decina(a) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(a + 30) = c Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,c) = 30 And Decina(c) = Decina(b) Then
e = Fuori90(b + 30)
If Fuori90(a + 30) = c Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,c) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(a + 30) = c Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,d) = 30 And Decina(a) = Decina(c) Then
e = Fuori90(c + 30)
If Fuori90(a + 30) = d Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,d) = 30 And Decina(a) = Decina(b) Then
e = Fuori90(b + 30)
If Fuori90(a + 30) = d Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,d) = 30 And Decina(d) = Decina(c) Then
e = Fuori90(c + 30)
If Fuori90(a + 30) = d Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If

If Distanza(a,d) = 30 And Decina(d) = Decina(b) Then
e = Fuori90(d + 30)
If Fuori90(a + 30) = d Then
f = Fuori90(a + 60)
Else
f = Fuori90(a + 30)
End If
End If


If Distanza(c,d) = 30 And Decina(c) = Decina(a) Then
e = Fuori90(a + 30)
If Fuori90(c + 30) = d Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

If Distanza(c,d) = 30 And Decina(c) = Decina(b) Then
e = Fuori90(b + 30)
If Fuori90(c + 30) = d Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

If Distanza(c,d) = 30 And Decina(d) = Decina(a) Then
e = Fuori90(a + 30)
If Fuori90(c + 30) = d Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

If Distanza(c,d) = 30 And Decina(d) = Decina(b) Then
e = Fuori90(b + 30)
If Fuori90(c + 30) = d Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If


If Distanza(b,c) = 30 And Decina(b) = Decina(a) Then
e = Fuori90(a + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

If Distanza(b,c) = 30 And Decina(b) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

If Distanza(b,c) = 30 And Decina(c) = Decina(a) Then
e = Fuori90(a + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
End If

If Distanza(b,c) = 30 And Decina(c) = Decina(d) Then
e = Fuori90(d + 30)
If Fuori90(c + 30) = b Then
f = Fuori90(c + 60)
Else
f = Fuori90(c + 30)
End If
'End If

co = co + 1
ruota(1) = r
ruota(2) = rr




Scrivi
Scrivi
Scrivi String(65,"*")
Scrivi DataEstrazione(es,1),1
ColoreTesto 1 :
Scrivi "&lt; " & "" & SiglaRuota(r) & " " & StringaEstratti(es,r) & " &gt; 1°numero = " & Format2(a) & " &gt; 2°numero = " & Format2(b) & " massimo a,b " & Massimo(a,b) & " distanza(a,b)" & Distanza(a,b),1
Scrivi "&lt; " & "" & SiglaRuota(rr) & " " & StringaEstratti(es,rr) & " &gt; 3°numero = " & Format2(c) & " &gt; 4°numero = " & Format2(d) & " max + dist x 3 " & Fuori90(Massimo(a,b) +(Distanza(a,b)*3)),1
Scrivi String(65,"-")
Scrivi co


n1(1) = e
n1(2) = f
n1(3) = Fuori90(e - 27)

ImpostaGiocata 18,n1,ruota,posta,9,2

Gioca es,,,1
End If
'Next
End If
'End If






'End If
Next
Next
Next
Next
Next
'Next
'Next
Scrivi
Scrivi String(65,"•")
ColoreTesto 2 : Scrivi "casi trovati : " & co,1
ColoreTesto 0 : Scrivi String(65,"•")
ScriviResoconto
ColoreTesto 1
ColoreTesto 1 : Scrivi "",1




End Sub
 
Ciao Bonalelw

Cioè di quelle 20 condizioni, deve essere vera solo una?

Guarda io sono andato in confusione solo con le 2 condizioni che hai postato
mi ha corretto Druid che ringrazio ancora.

Mi dispiace ma non me la sento di prendere questo impegno
 
Ultima modifica:
Ciao a Tutti

20 condizioni tutte diverse è vera ce ne deve essere solo una, la cosa mi ha incuriositò e non avendo altro da fare
ho voluto capire la logica di queste 20 condizioni, e sono arrivato alla conclusione che ne mancano ancora altri 4.

Mi spiego, praticamente i 4 estratti A, B, C, D, sono accoppiati a 2 a 2 (ambi) per ogni accoppiamento (ambo) ci
sono 4 condizioni diverse, le condizioni dello script sono 20, ma non può essere, perché con 4 numeri o lettere si
formano 6 ambi (coppie) non 5 quindi 6 per 4 = 24.
gli accoppiamenti nello script sono:
A B
A C
A D
CD
BC
manca
BD

La domanda è, la coppia che manca è voluta oppure è una dimenticanza?

Comunque lo script si può accorciare, mettendo anche delle FUNCTION, a tempo perso vedrò cosa posso fare.
 
Ultima modifica:
Ciao a Tutti

Seguendo la logica delle condizioni già fatte, ho fatto le 4 condizioni che mancavano
bisogna controllare che siano senza errori perché mi sono impappinato più di una volta

Ho notato che per ogni coppia il secondo IF-THEN è uguale per tutte e 4 le condizioni
di cui è composta (la coppia) , inoltre anche nel primo IF-THEN, la prima parte anché
qui è per tutte e 4 le condizioni uguale.

Di script ne preparato 2

Nel primo ho modificato solo la prima parte del primo IF-THEN, aggiungendo un altro
IF-THEN che controlla tutte e 4 le condizioni di ciascuna coppia e non modificando
il secondo IF-THEN anche se come ho già detto è uguale per tuutte e 4 le condizioni
di ciascuna coppia

Nel secondo oltre a fare le modifiche del primo script, ho tolto il secondo IF-THEN
che come ho già detto è uguale per le 4 condizioni di ogni coppia e al suo posto
ho messo il richiamo a una FUNCTION, praticamente dei 4 secondi IF-THEN ne
ho messo uno solo dentro la FUNCTION corrispondente.

Inoltre per tutti e 2 gli script ho indicizzato tutte le variabili perché io mi trovo
bene così, se per te è diverso li puoi sempre togliere.

Secondo me c'erano altre cose da aggiustare, però non ho voluto sconvolgere
più di tanto il tuo script, ho modificato solo l'indispensabile

Primo script
Codice:
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,MxAB,MaxAB_Distx3
   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)
                              If Fuori90(A + 30) = B Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 2
                           If Dec_A = Dec_D Then
                              E = Fuori90(D + 30)
                              If Fuori90(A + 30) = B Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 3
                           If Dec_B = Dec_C Then
                              E = Fuori90(C + 30)
                              If Fuori90(A + 30) = B Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 4
                           If Dec_B = Dec_D Then
                              E = Fuori90(D + 30)
                              If Fuori90(A + 30) = B Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           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)
                              If Fuori90(A + 30) = C Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 6
                           If Dec_A = Dec_D Then
                              E = Fuori90(D + 30)
                              If Fuori90(A + 30) = C Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 7
                           If Dec_C = Dec_B Then
                              E = Fuori90(B + 30)
                              If Fuori90(A + 30) = C Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 8
                           If Dec_C = Dec_D Then
                              E = Fuori90(D + 30)
                              If Fuori90(A + 30) = C Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           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)
                              If Fuori90(A + 30) = D Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 10
                           If Dec_A = Dec_B Then
                              E = Fuori90(B + 30)
                              If Fuori90(A + 30) = D Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 11
                           If Dec_D = Dec_C Then
                              E = Fuori90(C + 30)
                              If Fuori90(A + 30) = D Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 12
                           If Dec_D = Dec_B Then
                              E = Fuori90(D + 30)
                              If Fuori90(A + 30) = D Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           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)
                              If Fuori90(C + 30) = D Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           End If
                           'condizione 14
                           If Dec_C = Dec_B Then
                              E = Fuori90(B + 30)
                              If Fuori90(C + 30) = D Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           End If
                           'condizione 15
                           If Dec_D = Dec_A Then
                              E = Fuori90(A + 30)
                              If Fuori90(C + 30) = D Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           End If
                           'condizione 16
                           If Dec_D = Dec_B Then
                              E = Fuori90(B + 30)
                              If Fuori90(C + 30) = D Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           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)
                              If Fuori90(C + 30) = B Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           End If
                           'condizione 18
                           If Dec_B = Dec_D Then
                              E = Fuori90(D + 30)
                              If Fuori90(C + 30) = B Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           End If
                           ' condizione 19
                           If Dec_C = Dec_A Then
                              E = Fuori90(A + 30)
                              If Fuori90(C + 30) = B Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           End If
                           'condizione 20
                           If Dec_C = Dec_D Then
                              E = Fuori90(D + 30)
                              If Fuori90(C + 30) = B Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           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)
                              If Fuori90(B + 30) = D Then
                                 F = Fuori90(B + 60)
                              Else
                                 F = Fuori90(B + 30)
                              End If
                           End If
                           'condizione 22
                           If Dec_B = Dec_C Then
                              E = Fuori90(C + 30)
                              If Fuori90(B + 30) = D Then
                                 F = Fuori90(B + 60)
                              Else
                                 F = Fuori90(B + 30)
                              End If
                           End If
                           '
                           'condizione 23
                           If Dec_D = Dec_A Then
                              E = Fuori90(A + 30)
                              If Fuori90(B + 30) = D Then
                                 F = Fuori90(B + 60)
                              Else
                                 F = Fuori90(B + 30)
                              End If
                           End If
                           'condizione 24
                           If Dec_D = Dec_C Then
                              E = Fuori90(C + 30)
                              If Fuori90(B + 30) = D Then
                                 F = Fuori90(B + 60)
                              Else
                                 F = Fuori90(B + 30)
                              End If
                           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 "&lt; " & "" & SiglaRuota(R) & " " & StringaEstratti(Es,R) & " &gt; 1°numero = ",1,0
                        Scrivi Format2(A) & " &gt; 2°numero = " & Format2(B) & " massimo A,B " & Massimo(A,B),1,0
                        Scrivi " distanza(A,B)" & Distanza(A,B),1
                        Scrivi "&lt; " & "" & SiglaRuota(RR) & " " & StringaEstratti(Es,RR) & " &gt; 3°numero = " & Format2(C),1,0
                        Scrivi " &gt; 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 + 90) - 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

Secondo script

Codice:
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 "&lt; " & "" & SiglaRuota(R) & " " & StringaEstratti(Es,R) & " &gt; 1°numero = ",1,0
                        Scrivi Format2(A) & " &gt; 2°numero = " & Format2(B) & " massimo A,B " & Massimo(A,B),1,0
                        Scrivi " distanza(A,B)" & Distanza(A,B),1
                        Scrivi "&lt; " & "" & SiglaRuota(RR) & " " & StringaEstratti(Es,RR) & " &gt; 3°numero = " & Format2(C),1,0
                        Scrivi " &gt; 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
 
Ultima modifica:
Ciao a Tutti

Seguendo la logica delle condizioni già fatte, ho fatto le 4 condizioni che mancavano
bisogna controllare che siano senza errori perché mi sono impappinato più di una volta

Ho notato che per ogni coppia il secondo IF-THEN è uguale per tutte e 4 le condizioni
di cui è composta (la coppia) , inoltre anche nel primo IF-THEN, la prima parte anché
qui è per tutte e 4 le condizioni uguale.

Di script ne preparato 2

Nel primo ho modificato solo la prima parte del primo IF-THEN, aggiungendo un altro
IF-THEN che controlla tutte e 4 le condizioni di ciascuna coppia e non modificando
il secondo IF-THEN anche se come ho già detto è uguale per tuutte e 4 le condizioni
di ciascuna coppia

Nel secondo oltre a fare le modifiche del primo script, ho tolto il secondo IF-THEN
che come ho già detto è uguale per le 4 condizioni di ogni coppia e al suo posto
ho messo il richiamo a una FUNCTION, praticamente dei 4 secondi IF-THEN ne
ho messo uno solo dentro la FUNCTION corrispondente.

Inoltre per tutti e 2 gli script ho indicizzato tutte le variabili perché io mi trovo
bene così, se per te è diverso li puoi sempre togliere.

Secondo me c'erano altre cose da aggiustare, però non ho voluto sconvolgere
più di tanto il tuo script, ho modificato solo l'indispensabile

Primo script
Codice:
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,MxAB,MaxAB_Distx3
   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)
                              If Fuori90(A + 30) = B Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 2
                           If Dec_A = Dec_D Then
                              E = Fuori90(D + 30)
                              If Fuori90(A + 30) = B Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 3
                           If Dec_B = Dec_C Then
                              E = Fuori90(C + 30)
                              If Fuori90(A + 30) = B Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 4
                           If Dec_B = Dec_D Then
                              E = Fuori90(D + 30)
                              If Fuori90(A + 30) = B Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           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)
                              If Fuori90(A + 30) = C Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 6
                           If Dec_A = Dec_D Then
                              E = Fuori90(D + 30)
                              If Fuori90(A + 30) = C Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 7
                           If Dec_C = Dec_B Then
                              E = Fuori90(B + 30)
                              If Fuori90(A + 30) = C Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 8
                           If Dec_C = Dec_D Then
                              E = Fuori90(D + 30)
                              If Fuori90(A + 30) = C Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           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)
                              If Fuori90(A + 30) = D Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 10
                           If Dec_A = Dec_B Then
                              E = Fuori90(B + 30)
                              If Fuori90(A + 30) = D Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 11
                           If Dec_D = Dec_C Then
                              E = Fuori90(C + 30)
                              If Fuori90(A + 30) = D Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           End If
                           'condizione 12
                           If Dec_D = Dec_B Then
                              E = Fuori90(D + 30)
                              If Fuori90(A + 30) = D Then
                                 F = Fuori90(A + 60)
                              Else
                                 F = Fuori90(A + 30)
                              End If
                           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)
                              If Fuori90(C + 30) = D Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           End If
                           'condizione 14
                           If Dec_C = Dec_B Then
                              E = Fuori90(B + 30)
                              If Fuori90(C + 30) = D Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           End If
                           'condizione 15
                           If Dec_D = Dec_A Then
                              E = Fuori90(A + 30)
                              If Fuori90(C + 30) = D Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           End If
                           'condizione 16
                           If Dec_D = Dec_B Then
                              E = Fuori90(B + 30)
                              If Fuori90(C + 30) = D Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           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)
                              If Fuori90(C + 30) = B Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           End If
                           'condizione 18
                           If Dec_B = Dec_D Then
                              E = Fuori90(D + 30)
                              If Fuori90(C + 30) = B Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           End If
                           ' condizione 19
                           If Dec_C = Dec_A Then
                              E = Fuori90(A + 30)
                              If Fuori90(C + 30) = B Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           End If
                           'condizione 20
                           If Dec_C = Dec_D Then
                              E = Fuori90(D + 30)
                              If Fuori90(C + 30) = B Then
                                 F = Fuori90(C + 60)
                              Else
                                 F = Fuori90(C + 30)
                              End If
                           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)
                              If Fuori90(B + 30) = D Then
                                 F = Fuori90(B + 60)
                              Else
                                 F = Fuori90(B + 30)
                              End If
                           End If
                           'condizione 22
                           If Dec_B = Dec_C Then
                              E = Fuori90(C + 30)
                              If Fuori90(B + 30) = D Then
                                 F = Fuori90(B + 60)
                              Else
                                 F = Fuori90(B + 30)
                              End If
                           End If
                           '
                           'condizione 23
                           If Dec_D = Dec_A Then
                              E = Fuori90(A + 30)
                              If Fuori90(B + 30) = D Then
                                 F = Fuori90(B + 60)
                              Else
                                 F = Fuori90(B + 30)
                              End If
                           End If
                           'condizione 24
                           If Dec_D = Dec_C Then
                              E = Fuori90(C + 30)
                              If Fuori90(B + 30) = D Then
                                 F = Fuori90(B + 60)
                              Else
                                 F = Fuori90(B + 30)
                              End If
                           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 "&lt; " & "" & SiglaRuota(R) & " " & StringaEstratti(Es,R) & " &gt; 1°numero = ",1,0
                        Scrivi Format2(A) & " &gt; 2°numero = " & Format2(B) & " massimo A,B " & Massimo(A,B),1,0
                        Scrivi " distanza(A,B)" & Distanza(A,B),1
                        Scrivi "&lt; " & "" & SiglaRuota(RR) & " " & StringaEstratti(Es,RR) & " &gt; 3°numero = " & Format2(C),1,0
                        Scrivi " &gt; 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 + 90) - 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

Secondo script

Codice:
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 "&lt; " & "" & SiglaRuota(R) & " " & StringaEstratti(Es,R) & " &gt; 1°numero = ",1,0
                        Scrivi Format2(A) & " &gt; 2°numero = " & Format2(B) & " massimo A,B " & Massimo(A,B),1,0
                        Scrivi " distanza(A,B)" & Distanza(A,B),1
                        Scrivi "&lt; " & "" & SiglaRuota(RR) & " " & StringaEstratti(Es,RR) & " &gt; 3°numero = " & Format2(C),1,0
                        Scrivi " &gt; 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 = Fuor + 30)
   End If
End Function
Grazie mille x il tuo tempo. Verifico subito se tutto è ok.
Buona domenica
 

Ultima estrazione Lotto

  • Estrazione del lotto
    sabato 16 agosto 2025
    Bari
    22
    86
    27
    44
    02
    Cagliari
    38
    11
    60
    69
    27
    Firenze
    45
    54
    37
    35
    41
    Genova
    53
    46
    12
    18
    13
    Milano
    09
    61
    13
    86
    70
    Napoli
    54
    57
    34
    70
    35
    Palermo
    40
    25
    24
    67
    74
    Roma
    66
    30
    54
    56
    24
    Torino
    17
    75
    55
    13
    19
    Venezia
    78
    17
    12
    85
    90
    Nazionale
    72
    01
    46
    50
    52
    Estrazione Simbolotto
    Nazionale
    28
    26
    27
    21
    37
Indietro
Alto