Novità

Per Cinzia27

claudio8

Premium Member
Riprendo qui....
( post aperto a chiunque , ivi compresi Luigi e tutti i suoi alunni, me compreso )
sono ben accetti anche chiarimanti, suggerimenti e specifiche.

Cinzia27;n2103356 ha scritto:
Grazie, Claudio.
Spero che così vada bene.
Cinzia
Codice:
Sub Main()
ImpostaArchivio10ELotto(2)
Dim nam(1),T,V,sommato(1)
Dim nu(1),NuFr(90,5),NuAdd(1),aN(10),SFF(3),Nn(1)
Ini = EstrazioniArchivioDL - 25
fin = EstrazioniArchivioDL
'pos = CInt(InputBox("Quale posizione voglio sommare",,1))
clp = InputBox("Quanti Colpi di Gioco",,1)
For pos=1 To 5
'somma = InputBox("Quale sommativo voglio fare la somma",,14)

'smm = CInt(InputBox("Quante righe ",,1))
T = Array(T,"Info Estr"," Numeri Estrazione ","Pos.Est","Somm","Fre/casi","Num "," Esito ","Colpi","Verifica")' 9 titoli
Call InitTabella(T,3)

For es = Ini To fin
casi = casi + 1
co = 0
es1 = es + 1
es2 = es1 + clp
est = EstrattoDL(es,pos)
'------- calcolo sommativo ---------------
For sm = 1 To 90
co = co + 1
nu(1) = Fuori90(est + sm) ' estratto+ sommatico
NuFr(co,1) = sm
sf = SerieFreqDL (es1,es2,nu,1) ' frequente in 1 colpo
If sf > 0 Then
NuFr(co,2) = NuFr(co,2) + 1
End If
Next
Call OrdinaMatrice(NuFr,- 1,2)
'For i = 1 To smm
Nn(1) = Fuori90(nu(1) + NuFr(1,1))
'Next
'sommato(1) = Fuori90(EstrattoDL(es,pos) + somma)
ReDim V(9)' se aumantano i titoli dell'array "T" aumentare questo valore
V(1) = GetInfoEstrazioneDL(es)
V(2) = StringaEstrattiDL(es)
V(3) = pos & "°" & " - " & FormatSpace((est),2,-1)
V(4) = "+ " & FormatSpace(NuFr(1,1),2,-1)
V(5) = FormatSpace(NuFr(1,2),2,1) & "/" & casi & " Casi"
V(6) = Nn(1)
'V(7) = MEN(1)
sr = SerieRitardoDL(Ini,fin,Nn,1)
Call VerificaEsitoDL (Nn,es+1,1,clp,Esito,colpi,estratti)
V(7) = Esito
V(8) = colpi & "°"
V(9) = estratti
'V(10) = MEN(2)
'V(11) = MEN(3)
'V(12) = MEN(4)
'V(13) = MEN(5)
'V = Array(V,GetInfoEstrazioneDL(es),StringaEstrattiDL( es),somma & " + " & EstrattoDL(es,pos),pos,StringaNumeri(sommato),estr atti,colpi)
Call AddRigaTabella(V)
Next
SetTableWidth ("100%")
SetTableHeight ("100%")
Call CreaTabellaOrdinabile(,,,0,,False,False)
Next
End Sub

Come vedi, la formattazione/indentatura è sparita. Se provi a copiare il tuo listato in spaziometria e clicchi su Auto Formattazione codice vedrai che appariranno le indentature.
Queste, nello specifico dei costrutti servono ad identificare visivamente le sequenze delle operazione che esegue lo script.

Esempio con inserimento script nel post, dopo averlo formattato in spaziometria, copiato in Notebook e riportato tra i CODE del post ( nota la differnza visiva, che dà la possibilità di una diretta interpretazione del costrutto).
Spesso, molte richieste di modifiche vengono "inevase" perchè la non indentatura (cattiva presentazione) porta il lettore a dover copiare il tutto su spaziometria, per poi poterlo leggere, in maniera + chiara per cui considerato il poco tempo che si ha a disposizione, spesso si passa oltre.

Codice:
Sub GetCipECiop(Inizio,Fine,aRuota,Colpi,Cip,Ciop) ' sub che somma
    Dim arrAmbi
    Dim k,i,e,idEstr
    Dim bFound
    Cip = 0
    Ciop = 0
    Call Sviluppoambi(arrAmbi) ' chiama sub che sviluppa gli ambi
    For k = 1 To UBound(arrAmbi)
        bFound = True
        For idEstr = Inizio To Fine Step 9
            ReDim aNumInGioco(10)
            i = 5
            For e = 1 To 5
                i = i + 1
                aNumInGioco(e) = Fuori90(Estratto(idEstr,aRuota(1),e) + arrAmbi(k,1))
                aNumInGioco(i) = Fuori90(Estratto(idEstr,aRuota(1),e) + arrAmbi(k,2))
            Next
            If VerificaEsito(aNumInGioco,aRuota,idEstr + 1,2,Colpi) = False Then
                bFound = False
                'Call Scrivi  ("Ambo non valido " & arrAmbi(k,1) & "-" & arrAmbi(k,2) )
                Exit For
            End If
        Next
        If bFound Then
            Call Scrivi("Coppia di numeri che sommata all'estrazione base dia sempre almeno un ambo " & arrAmbi(k,1) & "-" & arrAmbi(k,2))
            Call Scrivi("")
            Call Scrivi(StringaNumeri(aNumInGioco))
            Cip = arrAmbi(k,1)
            Ciop = arrAmbi(k,2)
            Exit For
        End If
    Next
End Sub

Come vedi in questo costrutto ( costituito da una specifica Sub ) vi sono tre livelli di iterazione di cicli For ... next..
Senza l'indentatura, sarebbe meno evidente la loro identificazione e di conseguenza la lettura del significato operativo e sequenziale,degli stessi, cosa molto importante nella ideazione e creazione di un costrutto.
Spero di essere stato chiaro.

Ciao
 
Ultima modifica:

Cinzia27

Premium Member
Riprovo.
Codice:
Sub Main()
    ImpostaArchivio10ELotto(2)
    Dim nam(1),T,V,sommato(1)
    Dim nu(1),NuFr(90,5),NuAdd(1),aN(10),SFF(3),Nn(1)
    Ini = EstrazioniArchivioDL - 25
    fin = EstrazioniArchivioDL
    'pos = CInt(InputBox("Quale posizione voglio sommare",,1))
    clp = InputBox("Quanti Colpi di Gioco",,1)
    For pos = 1 To 5
        'somma = InputBox("Quale sommativo voglio fare la somma",,14)
        'smm = CInt(InputBox("Quante righe ",,1))
        T = Array(T,"Info Estr"," Numeri Estrazione ","Pos.Est","Somm","Fre/casi","Num "," Esito ","Colpi","Verifica")' 9 titoli
        Call InitTabella(T,3)
        For es = Ini To fin
            casi = casi + 1
            co = 0
            es1 = es + 1
            es2 = es1 + clp
            est = EstrattoDL(es,pos)
            '------- calcolo sommativo ---------------
            For sm = 1 To 90
                co = co + 1
                nu(1) = Fuori90(est + sm) ' estratto+ sommatico
                NuFr(co,1) = sm
                sf = SerieFreqDL(es1,es2,nu,1) ' frequente in 1 colpo
                If sf > 0 Then
                    NuFr(co,2) = NuFr(co,2) + 1
                End If
            Next
            Call OrdinaMatrice(NuFr,- 1,2)
            'For i = 1 To smm
            Nn(1) = Fuori90(nu(1) + NuFr(1,1))
            'Next
            'sommato(1) = Fuori90(EstrattoDL(es,pos) + somma)
            ReDim V(9)' se aumantano i titoli dell'array "T" aumentare questo valore
            V(1) = GetInfoEstrazioneDL(es)
            V(2) = StringaEstrattiDL(es)
            V(3) = pos & "°" & " - " & FormatSpace((est),2,- 1)
            V(4) = "+ " & FormatSpace(NuFr(1,1),2,- 1)
            V(5) = FormatSpace(NuFr(1,2),2,1) & "/" & casi & " Casi"
            V(6) = Nn(1)
            'V(7) = MEN(1)
            sr = SerieRitardoDL(Ini,fin,Nn,1)
            Call VerificaEsitoDL(Nn,es + 1,1,clp,Esito,colpi,estratti)
            V(7) = Esito
            V(8) = colpi & "°"
            V(9) = estratti
            'V(10) = MEN(2)
            'V(11) = MEN(3)
            'V(12) = MEN(4)
            'V(13) = MEN(5)
            'V = Array(V,GetInfoEstrazioneDL(es),StringaEstrattiDL( es),somma & " + " & EstrattoDL(es,pos),pos,StringaNumeri(sommato),estr atti,colpi)
            Call AddRigaTabella(V)
        Next
        SetTableWidth("100%")
        SetTableHeight("100%")
        Call CreaTabellaOrdinabile(,,,0,,False,False)
    Next
End Sub
 

claudio8

Premium Member
Va meglio.
Ti ho eliminato dal listato le righe che non servono e dichiarato quasi tutte e variabili, serve ad evitare errori di battittura che facilmente possono esserci nello stilare lo script anche di poche righe. .

Codice:
Sub Main()
    ImpostaArchivio10ELotto(2)
    Dim sommativo,Ini,fin,clp,es1,es2,est,sf,sr,Esito,colpi,estratti,T,V,pos
    Dim nu(1),NuFr(90,5),NuAdd(1),aN(10),SFF(3),Nn(1)
    Ini = EstrazioniArchivioDL - 25
    fin = EstrazioniArchivioDL
    clp = InputBox("Quanti Colpi di Gioco",,1)
    es1 = es + 1
    es2 = es1 + clp
    For pos = 1 To 5
        T = Array(T,"Info Estr"," Numeri Estrazione ","Pos.Est","Somm","Fre/casi","Num "," Esito ","Colpi","Verifica")' 9 titoli
        Call InitTabella(T,3)
        casi = 0
        For es = Ini To fin ' ciclo x controllo
            casi = casi + 1
            co = 0
            '------- calcolo sommativo ---------------
            est = EstrattoDL(es,pos)
            For sommativo = 1 To 90
                co = co + 1
                nu(1) = Fuori90(est + sommativo) ' estratto + sommativo
                NuFr(co,1) = sommativo
                sf = SerieFreqDL(es1,es2,nu,1) ' frequente in clp colpi
                If sf > 0 Then
                    NuFr(co,2) = NuFr(co,2) + 1 'contatore che aumenta il n° di volte in cui nu(1) azzecca l'estratto futuro
                End If
            Next
            Call OrdinaMatrice(NuFr,- 1,2) 'ordina matrice decres. x colonna casi storici azzeccati
            Nn(1) = Fuori90(nu(1) + NuFr(1,1)) ' numero previsto da verificare
            Call VerificaEsitoDL(Nn,es + 1,1,clp,Esito,colpi,estratti)
            ReDim V(9)' se aumantano i titoli dell'array "T" aumentare questo valore
            V(1) = GetInfoEstrazioneDL(es)
            V(2) = StringaEstrattiDL(es)
            V(3) = pos & "°" & " ->  " & FormatSpace((est),2,- 1)
            V(4) = "+ " & FormatSpace(NuFr(1,1),2,- 1)
            V(5) = FormatSpace(NuFr(1,2),2,1) & "/" & casi & " Casi" ' freq su il
            V(6) = Nn(1)
            V(7) = Esito
            V(8) = colpi & "°"
            V(9) = estratti
            Call AddRigaTabella(V)
        Next
        SetTableWidth("100%")
        SetTableHeight("100%")
        Call CreaTabellaOrdinabile(,,,0,,False,False)
    Next
End Sub

Ciao

Ps: qui trattiamo solo script del lotto e similari.
 
Ultima modifica:

Cinzia27

Premium Member
Ciao, Claudio.
Ti posto un listato che avevo fatto per me di qualche tempo fà.
Calcola i ritardi storici e attuali su tutte dell' ambo dopo una presenza esclusiva per 4 volte sulla stessa ruota.
Ho seguito i passi, ma la formattazione non è al massimo.
Se vuoi possiamo migliorarlo e trasformarlo anche per ciò che riguarda il contenuto.

Cinzia

Codice:
Option Explicit
Sub Main()
    Dim n(2),ru(1),rur(1),f,rr,q,q1,q2,q3,es,r,p,p1,s,s1,s2,s3,st,mx,c,c1,c2,c3,at,max,ri
    f = EstrazioneFin
    rr = 11
    rur(1) = rr
    q = 80:q1 = 70:q2 = 60:q3 = 50
    For es = f-500 To f
        For r = 1 To 10
            ru(1) = r
            For p = 1 To 4
                For p1 = p + 1 To 5
                    n(1) = Estratto(es,r,p)
                    If n(1) > 0 Then
                        n(2) = Estratto(es,r,p1)
                        s = SeriePrima(es + 1,f,n,ru,2)
                        If es+1<=f Then
                        If s > 0 Then
                            If SerieFreq(s,s,n,rur,2) < 2 Then
                                If SerieFreq(es + 1,s - 1,n,rur,2) = 0 Then
                                If es+1<=s-1 Then
                                    s1 = SeriePrima(s + 1,f,n,ru,2)
                                    If s+1<=f Then
                                    If s1 > 0 Then
                                        If SerieFreq(s1,s1,n,rur,2) < 2 Then
                                            If SerieFreq(s + 1,s1 - 1,n,rur,2) = 0 Then
                                            If s+1<=s1-1 Then
                                                s2 = SeriePrima(s1 + 1,f,n,ru,2)
                                                If s1+1<=f Then
                                                If s2 > 0 Then
                                                    If SerieFreq(s2,s2,n,rur,2) < 2 Then
                                                        If SerieFreq(s1 + 1,s2 - 1,n,rur,2) = 0 Then
                                                        If s1+1<=s2-1 Then
                                                            s3 = SeriePrima(s2 + 1,f,n,rur,2)
                                                            If s2+1<=f Then
                                                            If s3 > 0 Then
                                                                Messaggio es
                                                                st = s3 - s2
                                                                If st > mx Then mx = st
                                                                If st >= q Then c = c + 1
                                                                If st >= q1 Then c1 = c1 + 1
                                                                If st >= q2 Then c2 = c2 + 1
                                                                If st >= q3 Then c3 = c3 + 1
                                                                ColoreTesto 0
                                                                Scrivi FormatSpace(es,4,1) & " " & SiglaRuota(r) & " " & StringaNumeri(n) & " " & FormatSpace(s,4,1) & " " & _
                                                                FormatSpace(s1,4,1) & " " & FormatSpace(s2,4,1) & " " & FormatSpace(s3,4,1) & " " & FormatSpace(st,4,1) & " ",0,0
                                                                If s3 = f Then ColoreTesto 2:Scrivi "appena sortito" Else Scrivi
                                                            Else
                                                                If s3 = 0 Then
                                                                    at = SerieRitardo(s2,f,n,rur,2)
                                                                    If at > max Then max = at:ri = FormatSpace(es,4,1) & " " & SiglaRuota(r) & " " & StringaNumeri(n) & " " & FormatSpace(s,4,1) & _
                                                                    " " & FormatSpace(s1,4,1) & " " & FormatSpace(s2,4,1) & " " & FormatSpace(at,4,1)
                                                                    ColoreTesto 1
                                                                    Scrivi FormatSpace(es,4,1) & " " & SiglaRuota(r) & " " & StringaNumeri(n) & " " & FormatSpace(s,4,1) & " " & _
                                                                    FormatSpace(s1,4,1) & " " & FormatSpace(s2,4,1) & " " & FormatSpace(at,4,1) & " ",0,0
                                                                    If at >= q Then ColoreTesto 1 :Scrivi "GIOCABILE^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"Else Scrivi:ColoreTesto 0
                                                                    ColoreTesto 0
                                                                End If
                                                            End If
                                                        End If
                                                    End If
                                                End If
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                    End If
                    End If
                    End If
                    End If
                    End If
                    End If
                    End If
                Next
            Next
        Next
    Next
    Scrivi "'Massimo storico " & mx
    Scrivi "'st>= " & q & " " & c
    Scrivi "'st>= " & q1 & " " & c1
    Scrivi "'st>= " & q2 & " " & c2
    Scrivi "'st>= " & q3 & " " & c3
    Scrivi
    Scrivi "'GIOCABILE SE >= A " & q
    Scrivi "'" & ri
End Sub
 

claudio8

Premium Member
Cinzia27;n2103385 ha scritto:
Mi ricredo sulla formattazione : prima della pubblicazione andava a capo, ora mi sembra a posto.
La formattazione non è completa, ma va bene lo stesso in questo caso anche perchè con tutti gli If.. then che contiene, non è sicuramente leggibile sul post, occorre spostarlo su spaziometria.
Se vuoi possiamo trasformarlo, ma devi farlo principalmente tu, devi vedere se utilizzabili funzioni maggiormente dirette all'obbiettivo da ottenere, se vi sono costrutti ripetitivi definibili con specifiche sub ecc.ecc.

Predisponi una bozza di flusso del processo operativo dello script, come se dovessi fare il tutto da capo con carta e penna e poi ci proviamo, se ti va.

Ciao
 
Ultima modifica:

Cinzia27

Premium Member
Ecco qua, fatto a mano.
Codice:
Sub main()
ini=EstrazioneFin-1
fin=EstrazioneFin
Scrivi " Quantità di numeri pari per ruota dalla "&ini&" alla "&fin
    For es=ini To fin
    scrivi
    co=0
        For r=1 To 10
        co=0
            For p=1 To 5
            a=Estratto(es,r,p)
                If Pari(a)=True Then co=co+1
            Next
            Scrivi " "&formatspace(es,4,1)&" "&siglaruota(r)&" "&co
        Next
    next
End Sub

Ciao
Cinzia
 

claudio8

Premium Member
l'auto formattazione me lo dispone così, ma andiamo oltre.
Codice:
Sub Main()
    ini = EstrazioneFin - 1
    fin = EstrazioneFin
    Scrivi " Quantità di numeri pari per ruota dalla " & ini & " alla " & fin
    For es = ini To fin
        Scrivi
        For r = 1 To 10
            co = 0
            For p = 1 To 5
                a = Estratto(es,r,p)
                If pari(a) = True Then co = co + 1
            Next
            Scrivi " " & FormatSpace(es,4,1) & " " & SiglaRuota(r) & " " & co
        Next
    Next
End Sub
ciao
 

Cinzia27

Premium Member
Mi impegnerò con l' identazione.
Un' altra cosa che mi piacerebbe esplorare è do While e function .
Ciao

Codice:
Sub Main()
    Dim i
    For n = EstrazioneFin - 2 To EstrazioneFin
        a = SommaEstratti(n,1)
        b = sopra90(a)
        Scrivi b
    Next
    Scrivi
End Sub
Function sopra90(i)
    nn = i
    Do While nn > 90
        nn = nn - 90
    Loop
    sopra90 = nn
End Function
 

claudio8

Premium Member
Brava, ....
solo una piccola nota al tuo script, :D:D:D
la dichiarazione di i ----> (Dim i) non serve nel tuo script perchè viene usata solo nella function dove inserita nella firma (parametri nella parentesi) viene automaticamente dichiarata per la stessa, inoltre hai l'abitudine di inserire "Scrivi" spesso, anche quando non serve :rolleyes::rolleyes::rolleyes:. Ti ho inserito il fuori90 che sicuramente conosci e che sostituisce egregiamente la function....
Codice:
Sub Main
'Dim i
    For n = EstrazioneFin - 5 To EstrazioneFin
        a = Estratto(n,1,1) + Estratto(n,1,2)
        b = sopra90(a)
        Scrivi Fuori90(a)
        Scrivi DataEstrazione(n) & " - " & Estratto(n,1,1) & " + " & Estratto(n,1,2) & " = " & b
    Next
    'Scrivi
End Sub
Function sopra90(i)
    nn = i
    Do While nn > 90 'finchè nn > 90
        nn = nn - 90
    Loop
    sopra90 = nn
End Function
ciao
 

Ultima estrazione Lotto

  • Estrazione del lotto
    martedì 23 aprile 2024
    Bari
    47
    22
    34
    20
    50
    Cagliari
    33
    14
    86
    02
    62
    Firenze
    61
    22
    44
    19
    26
    Genova
    21
    12
    57
    82
    55
    Milano
    66
    05
    11
    70
    30
    Napoli
    05
    23
    25
    52
    73
    Palermo
    23
    44
    49
    71
    65
    Roma
    82
    37
    59
    34
    71
    Torino
    26
    42
    66
    15
    58
    Venezia
    57
    06
    68
    54
    84
    Nazionale
    21
    79
    49
    03
    01
    Estrazione Simbolotto
    Genova
    24
    02
    19
    03
    27
Alto