"Lotto" updated ... just for fun

Many of these are still available on line, add your comments, reviews, observations and suggestions for each in this section
Post Reply
User avatar
Yves
Global Admin
Posts: 31
Joined: Thu Jan 05, 2023 3:17 pm
Location: Montreal, Qc (CANADA)
Contact:

"Lotto" updated ... just for fun

Post by Yves »

Hi all,

Just because I have no imagination when the time comes to play Lotto, I've upgraded this small program to play it for me! It is done for my favorite games, very popular in Canada but of course, you can modify it as you wish...

Here is the code :

Code: Select all

LOTTO:

Rem Lotto LZ Ver 1.1
Rem (c) Dave Woolnough Sept 1996
Rem Lotto is a random number selector
Rem 6 numbers between 1 & 49 are choosen
Rem The routine Fixed Random Numbers is
Rem used to easily guarantee that no number
Rem is selected twice.
Rem ---
Rem Ver 1.2
Rem Modified by Yves MARTIN (2022 & 2024) YMartin.com
Rem Added: Lotto Max with 7 random numbers from 50
Rem Added: Grande Vie with 5 random umbers from 49
Rem plus 1 random Grand Numéro from 7

LOCAL b$(7,2),C$(1),G$(1),N$(100),M$(14),O$(23),R$(2),S$(100),T$(100)
LOCAL A%,B%,D%,E%,M%,N%,y%,z%

START::
CLS
O$="" :R$="" :S$="" :T$=""

PRINT "Selection",CHR$(63)
PRINT "L = 6/49"
PRINT "M = Lotto Max"
PRINT "G = Grande Vie"
C$=GET$
IF C$="L"
y%=6 :z%=7
CLS
AT 7,1 :PRINT"- 6/49 -"
N$="01020304050607080910111213141516171819202122232425262728293031323334353637383940414243444546474849"
B%=6 :D%=LEN(N$)/2
ELSEIF C$="M"
y%=7 :z%=8
CLS
AT 4,1 :PRINT"- Lotto Max -"
N$="0102030405060708091011121314151617181920212223242526272829303132333435363738394041424344454647484950"
B%=7 :D%=LEN(N$)/2
ELSEIF C$="G"
y%=5 :z%=6
CLS
AT 4,1 :PRINT"- Grande Vie -"
N$="01020304050607080910111213141516171819202122232425262728293031323334353637383940414243444546474849"
M$="1234567"
B%=5 :D%=LEN(N$)/2 :E%=LEN(M$)
GV::
M%=INT(RND*E%)
IF M%=0
GOTO GV::
ENDIF
ELSE
GOTO START::
ENDIF

DO
N%=INT(RND*D%)
A%=1
WHILE N%>0
A%=A%+2 :N%=N%-1
ENDWH
R$=MID$(N$,A%,2) :REM PRINT R$ :GET
S$=LEFT$(N$,A%-1) :REM PRINT S$ :GET
T$=RIGHT$(N$,LEN(N$)-(A%+1)) :REM PRINT T$ :GET
N$=S$+T$ :REM PRINT N$ :GET
IF LEFT$(R$,1)="0"
R$=RIGHT$(R$,1)
ENDIF
b$(b%)=r$
rem O$=O$+R$+" "
D%=D%-2 :B%=B%-1
UNTIL B%<1

a%=y%
While a%>0
b%=1
While b%<y%
If val(b$(b%+1)) < val(b$(b%))
r$=b$(b%)
b$(b%) = b$(b%+1)
b$(b%+1)=r$
endif
b%=b%+1
endwh
a%=a%-1
endwh

b%=1
While b%<z%
o$=o$+b$(b%)
o$=o$+" "
b%=b%+1
endwh 

IF C$="L"
AT 1,2 :PRINT " "; O$
ELSEIF C$="M"
AT 1,2 :PRINT O$
ELSE
AT 1,2 :PRINT O$; " (";M%;")"
ENDIF

AT 1,4 :PRINT"Again (Y/N)";CHR$(63)
G$=GET$
IF G$="Y"
CLS :GOTO START::
ENDIF
CLS :AT 4,2 :PRINT"Goodbye ..."
PAUSE 25
(...)

That's it folks!
Yves MARTIN
YMartin@CanaMail.com
YMartin.com
Post Reply