Seite 1 von 1

Lotto 6 aus 49

Verfasst: Mo 20. Jan 2025, 11:44
von Frank Wochatz
14 Mio sind gerade im Jackpot - Zeit mal mein Lottoscript zu aktualisieren!

Hier die neue Version, die nun auch die Zahlen innerhalb der Tipps sortiert. Das ist jetzt nicht der kleinst-mögliche Code, war dafür aber einfach umgesetzt.

Das Script gibt 8 Lottotipps für "6 aus 49" aus, die dann alle Zahlen jeweils genau einmal enthalten (also keine Zahlen doppelt). Da 8 Tipps x 6 Zahlen genau 48 ergibt, wird in der letzten Zeile die übrig gebliebene Zahl ausgegeben.
lotto.png
lotto.png (3.9 KiB) 217 mal betrachtet
Das Script ist Freeware. Wer damit den Jackpot knackt, überweist mir bitte 1% des Gewinns. Ehrensache und so weiter. :D

Code als lotto.cmd abspeichern, starten und gewinnen!

Code: Alles auswählen

/*LOTTOZAHLEN*/

InUseFlag = 0
do i=1 to 49
zahl.i = GetRandom()
end

/* sort */
/* tip 1 */
do i = 1 to 6
 do k = i+1 to 6
 if  zahl.k < zahl.i then do
   h = zahl.i
   zahl.i = zahl.k
   zahl.k = h
  end
 end
end

/* tip 2 */
do i = 7 to 12
 do k = i+1 to 12
 if  zahl.k < zahl.i then do
   h = zahl.i
   zahl.i = zahl.k
   zahl.k = h
  end
 end
end

/* tip 3 */
do i = 13 to 18
 do k = i+1 to 18
 if  zahl.k < zahl.i then do
   h = zahl.i
   zahl.i = zahl.k
   zahl.k = h
  end
 end
end

/* tip 4 */
do i = 19 to 24
 do k = i+1 to 24
 if  zahl.k < zahl.i then do
   h = zahl.i
   zahl.i = zahl.k
   zahl.k = h
  end
 end
end

/* tip 5 */
do i = 25 to 30
 do k = i+1 to 30
 if  zahl.k < zahl.i then do
   h = zahl.i
   zahl.i = zahl.k
   zahl.k = h
  end
 end
end

/* tip 6 */
do i = 31 to 36
 do k = i+1 to 36
 if  zahl.k < zahl.i then do
   h = zahl.i
   zahl.i = zahl.k
   zahl.k = h
  end
 end
end

/* tip 7 */
do i = 37 to 42
 do k = i+1 to 42
 if  zahl.k < zahl.i then do
   h = zahl.i
   zahl.i = zahl.k
   zahl.k = h
  end
 end
end

/* tip 8 */
do i = 43 to 48
 do k = i+1 to 48
 if  zahl.k < zahl.i then do
   h = zahl.i
   zahl.i = zahl.k
   zahl.k = h
  end
 end
end



call charout ,"Tipp 1 : " zahl.1 zahl.2 zahl.3 zahl.4 zahl.5 zahl.6 '0d0a'x
call charout ,"Tipp 2 : " zahl.7 zahl.8 zahl.9 zahl.10 zahl.11 zahl.12 '0d0a'x
call charout ,"Tipp 3 : " zahl.13 zahl.14 zahl.15 zahl.16 zahl.17 zahl.18 '0d0a'x
call charout ,"Tipp 4 : " zahl.19 zahl.20 zahl.21 zahl.22 zahl.23 zahl.24 '0d0a'x
call charout ,"Tipp 5 : " zahl.25 zahl.26 zahl.27 zahl.28 zahl.29 zahl.30 '0d0a'x
call charout ,"Tipp 6 : " zahl.31 zahl.32 zahl.33 zahl.34 zahl.35 zahl.36 '0d0a'x
call charout ,"Tipp 7 : " zahl.37 zahl.38 zahl.39 zahl.40 zahl.41 zahl.42 '0d0a'x
call charout ,"Tipp 8 : " zahl.43 zahl.44 zahl.45 zahl.46 zahl.47 zahl.48 '0d0a'x
call charout ,"Verbl. : " zahl.49

exit

GetRandom:
do until InUseFlag = 0
rc=RANDOM(1, 49)
if length(rc) = 1 then rc = 0||rc
do z = 1 to i
if rc = zahl.z then
    do
      InUseFlag = 1
      leave
    end
   else InUseFlag = 0
end /* z */
end /* until */

return rc

Alle Angaben ohne Gewähr.

Re: Lotto 6 aus 49

Verfasst: Mo 20. Jan 2025, 14:32
von eCSBenutzer
Sind die Gewinnzahlen für übernächste Woche schon implementiert? :lol:
Da ist der Jackpot (für mich) dann akzeptabel! :D

Re: Lotto 6 aus 49

Verfasst: Mo 20. Jan 2025, 16:38
von Frank Wochatz
Ja, ist alles drin! :D