Novità

Mente da programmatore

Siete i miei tre super moschettieri... programmatori preferiti... vi ammiro.., e invidio... (positivamente) dal divano... con il popcorn in mano... :LOL: :D 💪👌 👏 Good 1.11 👋:)
Aimè programmatore è solo LuigiB :) io sono solo un povero ragazzo che prova a diventarlo... imparando il più possibile da un persona con anni di esperienza. Magari non lo diventerò al 100% ma grazie a lui saprò il fatto mio :ROFLMAO::ROFLMAO::ROFLMAO:
 
Codice:
  Friend Function GetEstrazione(idEstr As Integer, RetEstr As StrEstrazione) As Boolean
Dim GetEstr as Boolean
        If IsIdEstrValido(idEstr) Then
            RetEstr = Estrazioni(idEstr)
            GetEstr  = True
        End If
       return GetEstr
    End Function
Codice:
  Friend Function GetEstrazione(idEstr As Integer, byref RetEstr As StrEstrazione) As Boolean
 
        If IsIdEstrValido(idEstr) Then
            RetEstr = Estrazioni(idEstr)
           return  True
        End If
       return false
    End Function

Attenzione al byref ,se non lo metti non torna indietro la variabile valorizzata.
 
la funzione QuantitaNumeriDiversi va lanciata dentro un ciclo sulle 11 ruote , appena una ruota torna un valore diverso da 0 o da 5 quella ruota ha numeri errati.
Per contare quanti numeri diversi ci sono , sapendo che ne devi gestire 90 nella funzionq QuantitaNumeriDiversi puoi creare un array boolean di 90 elementi e incrementare un contatore solo se il relativo elemento n è false , se lo è lo conti e lo metti a true , non devi gestire lo 0 senno per le estrazioni che correttamente non hanno i numeri questa funzione tornerebbe 1 , ovvero unsolo numero usato lo 0 mentre noi vogliamo che i numeri usati siano o 0 o 5.
 
Si avevo immaginato ... ma sbaglio ancora qualcosa

Codice:
   Function IsEstrazioneValida(strctEst As StrEstrazione) As Boolean


        If IsIdEstrValido(strctEst.identifier) Then
            If IsNumeroEstrValido(strctEst.Data.Numero) Then
                For k = 1 To 11
                    If QuantitaNumeriDiversi(GetArrayEstratti(strctEst)) = 55 Then
                        Return True
                    End If

                Next
            End If
        End If
    End Function
    Function QuantitaNumeriDiversi(aN() As Integer) As Integer
        Dim qNumeri As Integer
        Dim aB(90) As Boolean
        For k = 1 To 5
            If IsNumeroValidoLotto(aN(k)) Then
                If aB(aN(k)) = False Then
                    aB(aN(k)) = True
                    qNumeri += 1
                End If
            End If

        Next
        Return qNumeri
    End Function
 
Ciao le imposti a false fuori dal ciclo
Dentro quelli sortiti li imposti a true .
Ciao :)
Ma non bisognerebbe escludere i numeri ripetuti nella stessa ruota?
O oppure è stato fatto in un sltra funzione?
Scusate se chiedo cose così semplici, ma per me non lo sono :(
 
Codice:
Function QuantitaNumeriDiversi(aN() As Integer) As Integer
        Dim qNumeri As Integer
        Dim aB(90) As Boolean
        For k = 1 To 5
            If IsNumeroValidoLotto(aN(k)) Then
                If aB(aN(k)) = False Then
                    aB(aN(k)) = True
                    qNumeri += 1
                End If
            End If

        Next
        Return qNumeri
    End Function


questa funzione deve operare su aN

quindi fai For k = 1 To ubound(aN)

non controlalre qui se il numero è valido , questa come detto deve tornare asolo la quantita contata dei numeri diversi

nel ciclo ogni volta che lanci QuantitaNumeriDiVersi ti memorizzi il risultato , se il risultato è diverso da 0 o da 5 vuol dire che qulla ruota è sbagliata.
 
Dopo un pomeriggio penso di esserci riuscito:

Codice:
    Function IsEstrazioneValida(strctEst As StrEstrazione) As Boolean

        If IsIdEstrValido(strctEst.identifier) Then
            If IsNumeroEstrValido(strctEst.Data.Numero) Then
                For k = 1 To 11
                    If QuantitaNumeriDiversi(GetArrayEstratti(strctEst, k)) = 0 Or 5 Then
                        Return True
                    End If
                Next
            End If
        End If
    End Function


    Function QuantitaNumeriDiversi(aN() As Integer) As Integer
        Dim qNumeri As Integer
        Dim aB(90) As Boolean
        For k = 1 To UBound(aN)
            For y = 1 To 5
                If aB(aN(y)) = False Then
                    aB(aN(y)) = True
                    qNumeri += 1
                End If
            Next
            Return qNumeri
        Next
    End Function

    Function GetArrayEstratti(strctest As StrEstrazione, ruota As Integer) As Integer()
        Dim aN() As Integer
        Dim i As Integer
        For r = ruota To 11
            For e = 1 To 5
                i += 1
                ReDim Preserve aN(i)
                aN(i) = strctest.Ruote(r).Estratto(e)
            Next
        Next
        Return aN
    End Function
 
Ho dimenticato di verificare se è un numero valido per il lotto:

Codice:
    Function GetArrayEstratti(strctest As StrEstrazione, ruota As Integer) As Integer()
        Dim aN() As Integer
        Dim i As Integer
        For r = ruota To 11
            For e = 1 To 5
                i += 1
                ReDim Preserve aN(i)
                If IsNumeroValidoLotto(strctest.Ruote(r).Estratto(e)) Then
                    aN(i) = strctest.Ruote(r).Estratto(e)
                End If
            Next
        Next
        Return aN
    End Function
 
per tirare le somme riposta il progetto anche per consentire agli altri di seguire meglio.
 
 
itanto buon lavoro al buon legend , veniamo a noi

qui c'è un errore che ti avevo gia segnalato

1635785081680.png


questa sotto è una funzione che servesolo alla classe archivio , lasciala private nella classe archivio

1635785197359.png

hai creato una funzione che fa la stessa cosa di un'altra

1635785253831.png

qui stai sbagliando
alla prima ruota che va benme uscirebeb dal ciclo perche tu sai che quando usiamo la parola chiave Return la funzione assume il valore che gli diamo ed esce immediatamente.
Devi fare al contrario , l'estrazione fino a prova contraria è valida.

1635785345938.png




qui non va bene che c'entra il ciclo con la y ?

1635785453100.png


anche qui c'è da rivedere alla funzione QuantitaNumeriDiversi puoi passare direttamente l'array estratti della struttura senza quel GetArrayEstratti

1635785585970.png


qui bisogna implementare e una parte di codice gia ce l'hai quella che scrive le modifiche sul file delle estrazioni , devi dichiarare le variabili che non sono gia dichiarate , gestire il fatto che idEstr sia maggiore di ubound(Estrazioni) se lo è lo deve essere solo di una unità va controllato , vul dire che strai aggiungendo un 'estrazione all'array
se non lo è devi valorizzare l'elemento idEstr dell'array estrazioni con l'estrazione che abbiamo passato per parametro.

1635785724274.png
 
Ok ho corretto tutto :

Codice:
    Function IsEstrazioneValida(strctEst As StrEstrazione) As Boolean
        Dim bRet As Boolean
        If IsIdEstrValido(strctEst.identifier) Then
            If IsNumeroEstrValido(strctEst.Data.Numero) Then
                For r = 1 To 11
                    If QuantitaNumeriDiversi(strctEst.Ruote(r).Estratto) = 0 Or 5 Then
                        bRet = True
                    End If
                Next
            End If
        End If
        Return bRet
    End Function
   
    Function QuantitaNumeriDiversi(aN() As Integer) As Integer
        Dim qNumeri As Integer
        Dim aB(90) As Boolean
        For k = 1 To UBound(aN)
            If aB(aN(k)) = False Then
                If aB(aN(k)) <> 0 Then
                    aB(aN(k)) = True
                    qNumeri += 1
                End If
            End If
        Next
        Return qNumeri
    End Function
 
Ultima modifica:
qui non va ben

Codice:
 Function IsEstrazioneValida(strctEst As StrEstrazione) As Boolean
        Dim bRet As Boolean
        If IsIdEstrValido(strctEst.identifier) Then
            If IsNumeroEstrValido(strctEst.Data.Numero) Then
                For r = 1 To 11
                    If QuantitaNumeriDiversi(strctEst.Ruote(r).Estratto) = 0 Or 5 Then
                        bRet = True
                    End If
                Next
            End If
        End If
        Return bRet
    End Function
 
prova a chiederti quand'è che torna false questa funzione ? E Quando invece dovrebe tornarlo ?
 
Aaaaaaaaaah ora penso di aver capito :

Codice:
   Function IsEstrazioneValida(strctEst As StrEstrazione) As Boolean
        Dim bRet As Boolean
        If IsIdEstrValido(strctEst.identifier) Then
            If IsNumeroEstrValido(strctEst.Data.Numero) Then
                For r = 1 To 11
                    If QuantitaNumeriDiversi(strctEst.Ruote(r).Estratto) = 0 Or 5 Then
                        bRet = True
                    Else
                        Return False
                    End If
                Next
            End If
        End If
        Return bRet
    End Function
 

Ultima estrazione Lotto

  • Estrazione del lotto
    sabato 24 gennaio 2026
    Bari
    26
    24
    81
    30
    32
    Cagliari
    84
    81
    48
    08
    49
    Firenze
    64
    30
    70
    12
    89
    Genova
    76
    71
    63
    88
    27
    Milano
    01
    28
    09
    06
    90
    Napoli
    74
    26
    50
    76
    24
    Palermo
    09
    75
    88
    65
    13
    Roma
    66
    13
    21
    65
    73
    Torino
    78
    02
    90
    51
    16
    Venezia
    23
    55
    60
    47
    17
    Nazionale
    14
    70
    74
    68
    20
    Estrazione Simbolotto
    Bari
    09
    18
    15
    38
    39
Indietro
Alto