8-Bit Software Online Conversion
Lottery. Game - Listing
10:
20:
30REM" LOTTERY
40REM" Program by Rushden Roy
A 'L Plate' programmer
for public domain on a
Master128 NOVEMBER 94
50:
60MODE7
70VDU23,1,0;0;0;0;
80ON ERROR PROCerror:END
90*FX12
100PROCROY
110PROCfp
120PROCspa
125A%=0:Z%=0:X%=0
130PROCspg
140PROCspa
150*FX11,0
160seed=RND(-TIME)
170A%=A%
180Z%=Z%
190X%=X%
200CLEAR
210scoreA=0
220tot%=0
230ran1%=RND(9)
240ran2%=RND(9):IF ran2%=ran1% GOTO240
250ran3%=RND(9):IF ran3%=ran2%ORran3%=
ran1% GOTO250
260ran4%=RND(9):IF ran4%=ran3%ORran4%=
ran2%ORran4%=ran1% GOTO260
270PROClayout4
280VDU23,1,1;0;0;0;
290PROCinputA
300PROCchA
310PROCchB
320PROCchC
330VDU23,1,0;0;0;0;
340PRINTTAB(0,23)CHR$(132)CHR$(157)CHR
$(135)" Press SPACE to start the draw
"
350REPEAT UNTIL GET=32
360PRINTTAB(0,23)STRING$(35," ")
370PROCballs(0,ran1%,CHR$(131))
380PROCballs(7,ran2%,CHR$(133))
390PROCballs(14,ran3%,CHR$(129))
400PROCballs(21,ran4%,CHR$(130))
410PROCrandinorder
420PRINTTAB(0,23)CHR$(132)CHR$(157)CHR
$(135)" Press SPACE to check win or los
e "
430REPEAT UNTIL GET=32
440PROCshowsc(scoreA,6,"A")
450PROCshowsc(scoreB,8,"B")
460PROCshowsc(scoreC,10,"C")
470PROCgames
480PRINTTAB(0,23)CHR$(132)CHR$(157)CHR
$(135)"SPACE another go. Other key to QU
IT"
490*FX5,1
500IF GET$<>" " CLS:PROCendprog ELSE G
OTO130
510DEF PROCinputA
520PRINTTAB(ran1%+20,12-12)CHR$(132)CH
R$(46)
530PRINTTAB(5,18);CHR$(132);CHR$(130)"
^"
540REPEAT:INPUTTAB(3,19)"1st A No.";nu
m1%:IF num1%<1OR num1%>9:PRINTTAB(11,19)
" ":UNTIL num1%>=1 AND num1%<=9
550PRINTTAB(5,num1%+6)CHR$(134);"/"
560REPEAT:INPUTTAB(3,20)"2nd A No.";nu
m2%:IF num2%<1OR num2%>9:PRINTTAB(11,20)
" ":UNTIL num2%>=1 AND num2%<=9
570PRINTTAB(5,num2%+6)CHR$(134);"/"
580REPEAT:INPUTTAB(3,21)"3rd A No.";nu
m3%:IF num3%<1OR num3%>9:PRINTTAB(11,21)
" ":UNTIL num3%>=1 AND num3%<=9
590PRINTTAB(5,num3%+6)CHR$(134);"/"
600REPEAT:INPUTTAB(3,22)"4th A No.";nu
m4%:IF num4%<1OR num4%>9:PRINTTAB(11,22)
" ":UNTIL num4%>=1 AND num4%<=9
610PRINTTAB(5,num4%+6)CHR$(134);"/"
620PROCinputB
630ENDPROC
640DEF PROCinputB
650PRINTTAB(ran1%+19,12-12)SPC(3)
660PROCblankout(19)
670PRINTTAB(11,18);CHR$(132);CHR$(130)
"^"
680REPEAT:INPUTTAB(9,19)"1st B No.";nu
m5%:IF num5%<1OR num5%>9:PRINTTAB(16,19)
" ":UNTIL num5%>=1 AND num5%<=9
690PRINTTAB(11,num5%+6)CHR$(134);"/"
700REPEAT:INPUTTAB(9,20)"2nd B No.";nu
m6%:IF num6%<1OR num6%>9:PRINTTAB(16,20)
" ":UNTIL num6%>=1 AND num6%<=9
710PRINTTAB(11,num6%+6)CHR$(134);"/"
720REPEAT:INPUTTAB(9,21)"3rd B No.";nu
m7%:IF num7%<1OR num7%>9:PRINTTAB(16,21)
" ":UNTIL num7%>=1 AND num7%<=9
730PRINTTAB(11,num7%+6)CHR$(134);"/"
740REPEAT:INPUTTAB(9,22)"4th B No.";nu
m8%:IF num8%<1OR num8%>9:PRINTTAB(16,22)
" ":UNTIL num8%>=1 AND num8%<=9
750PRINTTAB(11,num8%+6)CHR$(134);"/"
760PROCinputC
770ENDPROC
780DEF PROCinputC
790PROCblankout(29)
800PRINTTAB(17,18);CHR$(132);CHR$(130)
"^"
810REPEAT:INPUTTAB(15,19)"1st C No.";n
um9%:IF num9%<1OR num9%>9:PRINTTAB(23,19
)" ":UNTIL num9%>=1 AND num9%<=9
820PRINTTAB(17,num9%+6)CHR$(134);"/"
830REPEAT:INPUTTAB(15,20)"2nd C No.";n
um10%:IF num10%<1OR num10%>9:PRINTTAB(23
,20)" ":UNTIL num10%>=1 AND num10%
<=9
840PRINTTAB(17,num10%+6)CHR$(134);"/"
850REPEAT:INPUTTAB(15,21)"3rd C No.";n
um11%:IF num11%<1OR num11%>9:PRINTTAB(23
,21)" ":UNTIL num11%>=1 AND num11%
<=9
860PRINTTAB(17,num11%+6)CHR$(134);"/"
870REPEAT:INPUTTAB(15,22)"4th C No.";n
um12%:IF num12%<1OR num12%>9:PRINTTAB(23
,22)" ":UNTIL num12%>=1 AND num12%
<=9
880PRINTTAB(17,num12%+6)CHR$(134);"/"
890PROCblankout(37)
900ENDPROC
910DEF PROCchA
920IF ran1%=num1%ORran1%=num2%ORran1%=
num3%ORran1%=num4%:scoreA=scoreA+1 ELSE
scoreA=scoreA
930IF ran2%=num1%ORran2%=num2%ORran2%=
num3%ORran2%=num4%: scoreA=scoreA+1 ELSE
scoreA=scoreA
940IF ran3%=num1%ORran3%=num2%ORran3%=
num3%ORran3%=num4%: scoreA=scoreA+1 ELSE
scoreA=scoreA
950IF ran4%=num1%ORran4%=num2%ORran4%=
num3%ORran4%=num4%: scoreA=scoreA+1 ELSE
scoreA=scoreA
960ENDPROC
970DEF PROCshowsc(sc,tab,abc$)
980PRINTTAB(27,tab-1);CHR$(131);" ";a
bc$" Score"
990IFsc=0 tot%=tot%+0:PRINTTAB(27,tab)
;CHR$(131);"0=0 points "
1000IFsc=1 tot%=tot%+0:PRINTTAB(27,tab)
;CHR$(131);"1=0 points "
1010IFsc=2 tot%=tot%+10:PRINTTAB(27,tab
);CHR$(131)"2=10 points"
1020IFsc=3 tot%=tot%+30:PRINTTAB(27,tab
);CHR$(131)"3=30 points"
1030IFsc=4 tot%=tot%+90:SOUND1,-14,30,1
0:PRINTTAB(26,tab);CHR$(131)CHR$(136)"4=
90 points":PRINTTAB(26,11)CHR$(129)CHR$(
136)" JACKPOT"
1040PRINTTAB(27,4)CHR$(131)"YOUR SCORE"
1050PRINTTAB(27,12)CHR$(131)" Win
"
1060PRINTTAB(28,13)CHR$(131);tot%;" poi
nts "
1070PRINTTAB(27,15)CHR$(131)" Net win"
1080PRINTTAB(27,16)CHR$(131);tot%-30;"
points "
1090grandtot%=tot%-30
1100ENDPROC
1110DEF PROCgames
1120Z%=Z%+1
1130PRINTTAB(29,18)CHR$(130)"PLAYED"
1140IFZ%=1 PRINTTAB(30,19);Z%;" GAME"
1150IFZ%>1 PRINTTAB(29,19);Z%;" GAMES"
1160X%=grandtot%
1170A%=A%+X%
1180PRINTTAB(30,21);A%" pts."
1190IFA%=0 PRINTTAB(29,22)CHR$(130)"EVE
NS"
1200IFA%<0 PRINTTAB(24,22)CHR$(130)"YOU
R'E LOSING!"
1210IFA%>0 PRINTTAB(24,22)CHR$(130)"YOU
R'E WINNING"
1220A%=A%
1230ENDPROC
1240DEF PROCchB
1250IF ran1%=num5%ORran1%=num6%ORran1%=
num7%ORran1%=num8%:scoreB=scoreB+1 ELSE
scoreB=scoreB
1260IF ran2%=num5%ORran2%=num6%ORran2%=
num7%ORran2%=num8%: scoreB=scoreB+1 ELSE
scoreB=scoreB
1270IF ran3%=num5%ORran3%=num6%ORran3%=
num7%ORran3%=num8%: scoreB=scoreB+1 ELSE
scoreB=scoreB
1280IF ran4%=num5%ORran4%=num6%ORran4%=
num7%ORran4%=num8%: scoreB=scoreB+1 ELSE
scoreB=scoreB
1290ENDPROC
1300DEF PROCchC
1310IF ran1%=num9%ORran1%=num10%ORran1%
=num11%ORran1%=num12%:scoreC=scoreC+1 EL
SE scoreC=scoreC
1320IF ran2%=num9%ORran2%=num10%ORran2%
=num11%ORran2%=num12%: scoreC=scoreC+1 E
LSE scoreC=scoreC
1330IF ran3%=num9%ORran3%=num10%ORran3%
=num11%ORran3%=num12%: scoreC=scoreC+1 E
LSE scoreC=scoreC
1340IF ran4%=num9%ORran4%=num10%ORran4%
=num11%ORran4%=num12%: scoreC=scoreC+1 E
LSE scoreC=scoreC
1350ENDPROC
1360DEF PROClayout4
1370CLS
1390PRINTTAB(0,1)CHR$(132)CHR$(157)CHR$
(135)" JACKPOT WINNER?...IT COULD BE YOU
."
1400PRINTTAB(0,2)CHR$(132)CHR$(157)CHR$
(135)"Cost of PLAYSLIP 3 X 10 = 30 Point
s"
1410PRINTTAB(0,3)CHR$(132)CHR$(157)CHR$
(135)"To win, match 2=10, 3=30, 4=90 pts
."
1420PRINTTAB(2,4)CHR$(130)" BOARD BOAR
D BOARD"
1430PRINTTAB(3,5)CHR$(151)STRING$(19,CH
R$255)
1440PRINTTAB(3,6)CHR$(151)CHR$(255)" "C
HR$(130)"A "CHR$(151)CHR$(255)" "CHR$(13
0)"B "CHR$(151)CHR$(255)" "CHR$(130)"C "
CHR$(151)CHR$(255)
1450PRINTTAB(3,7)CHR$(151)CHR$(255)CHR$
(129)" 1 "CHR$(151)CHR$(255)CHR$(129)" 1
"CHR$(151)CHR$(255)CHR$(129)" 1 "CHR$(1
51)CHR$(255)
1460PRINTTAB(3,8)CHR$(151)CHR$(255)CHR$
(129)" 2 "CHR$(151)CHR$(255)CHR$(129)" 2
"CHR$(151)CHR$(255)CHR$(129)" 2 "CHR$(1
51)CHR$(255)
1470PRINTTAB(3,9)CHR$(151)CHR$(255)CHR$
(129)" 3 "CHR$(151)CHR$(255)CHR$(129)" 3
"CHR$(151)CHR$(255)CHR$(129)" 3 "CHR$(1
51)CHR$(255)
1480PRINTTAB(3,10)CHR$(151)CHR$(255)CHR
$(129)" 4 "CHR$(151)CHR$(255)CHR$(129)"
4 "CHR$(151)CHR$(255)CHR$(129)" 4 "CHR$(
151)CHR$(255)
1490PRINTTAB(3,11)CHR$(151)CHR$(255)CHR
$(129)" 5 "CHR$(151)CHR$(255)CHR$(129)"
5 "CHR$(151)CHR$(255)CHR$(129)" 5 "CHR$(
151)CHR$(255)
1500PRINTTAB(3,12)CHR$(151)CHR$(255)CHR
$(129)" 6 "CHR$(151)CHR$(255)CHR$(129)"
6 "CHR$(151)CHR$(255)CHR$(129)" 6 "CHR$(
151)CHR$(255)
1510PRINTTAB(3,13)CHR$(151)CHR$(255)CHR
$(129)" 7 "CHR$(151)CHR$(255)CHR$(129)"
7 "CHR$(151)CHR$(255)CHR$(129)" 7 "CHR$(
151)CHR$(255)
1520PRINTTAB(3,14)CHR$(151)CHR$(255)CHR
$(129)" 8 "CHR$(151)CHR$(255)CHR$(129)"
8 "CHR$(151)CHR$(255)CHR$(129)" 8 "CHR$(
151)CHR$(255)
1530PRINTTAB(3,15)CHR$(151)CHR$(255)CHR
$(129)" 9 "CHR$(151)CHR$(255)CHR$(129)"
9 "CHR$(151)CHR$(255)CHR$(129)" 9 "CHR$(
151)CHR$(255)
1540PRINTTAB(3,16)CHR$(151)CHR$(255)"
"CHR$(151)CHR$(255)" "CHR$(151)CHR$
(255)" "CHR$(151)CHR$(255)
1550PRINTTAB(3,17)CHR$(151)STRING$(19,C
HR$255)
1560PRINTTAB(0,23)CHR$(132)CHR$(157)CHR
$(135)" Type your chosen numbers (1to9)
"
1570ENDPROC
1580DEF PROCblankout(x)
1590PRINTTAB(0,18)SPC(x)
1600PRINTTAB(0,19)SPC(x)
1610PRINTTAB(0,20)SPC(x)
1620PRINTTAB(0,21)SPC(x)
1630PRINTTAB(0,22)SPC(x)
1640ENDPROC
1650DEF PROCrandinorder
1660PRINTTAB(23,ran1%+6)CHR$(133)"<";ra
n1%;CHR$(135)
1670PRINTTAB(23,ran2%+6)CHR$(133)"<";ra
n2%;CHR$(135)
1680PRINTTAB(23,ran3%+6)CHR$(133)"<";ra
n3%;CHR$(135)
1690PRINTTAB(23,ran4%+6)CHR$(133)"<";ra
n4%;CHR$(135)
1700ENDPROC
1710DEF PROCballs(x,r%,c$)
1720FORa%=1TO9
1730FORdelay=1TO200:NEXT
1740PRINTTAB(x,19)c$" :";a%;":"
1750PRINTTAB(x,20)c$":";a%;":";a%;":"
1760PRINTTAB(x,21)c$" :";a%;":"
1770NEXT
1780PRINTTAB(x,19)c$" :";r%;":"
1790PRINTTAB(x,20)c$":";r%;":";r%;":"
1800PRINTTAB(x,21)c$" :";r%;":"
1810FORdelay=1TO2000:NEXT
1820ENDPROC
1830DEF PROCspa
1840a$=""+CHR$(132)+CHR$(157)+CHR$(135)
+"Press SPACE to continue. "+CHR$(156)+C
HR$(13):PRINTTAB(5,23)a$
1850*FX15,1
1860REPEAT UNTIL GET=32
1870ENDPROC
1880DEFPROCROY
1890PRINT" PROGRAM B
Y ££££££££"
1900PRINT"
k 7e757£k"
1910PRINT"
s550!5u0£5"
1920PRINT"
p5u7t5upp5"
1930PRINT
1940PRINT" FOR 8-BIT SOFTWARE"
1950PRINT" 17 Lambert Park Rd Hedon HUL
L HU12 8HF"
1960ENDPROC
1970DEF PROCdh(C%,L%,D%,A$)
1980IF D% A$=CHR$(141)+A$
1990X%=(40-LENA$)DIV 2-1
2000FORY%=L%TOL%+D%:PRINTTAB(X%,Y%);CHR
$(128+C%);A$:NEXT
2010ENDPROC
2020DEF PROCfp
2030PROCdh(6,10,1,"LOTTERY.")
2040PROCdh(6,12,1,"This one is free")
2050PROCdh(6,14,1,"No money needed")
2060PROCdh(6,16,1,"(No money won!)")
2070ENDPROC
2080DEF PROCspg
2090CLS
2100PROCdh(3,1,1,"INFORMATION ")
2110PROCdh(3,3,1,"----------- ")
2120PROCdh(6,5,1,"To play the LOTTERY s
elect")
2130PROCdh(6,7,1,"four numbers (1to9) f
or each board.")
2140PROCdh(6,9,1,"You must mark all thr
ee boards.")
2150PROCdh(6,11,1,"Each board cost ten
points.")
2160PROCdh(6,13,1,"Thirty points will b
e deducted for")
2170PROCdh(6,15,1,"each draw. The draw
will show four")
2180PROCdh(6,17,1,"winning Nos. Then ch
eck your boards")
2190PROCdh(6,19,1,"to see if you have w
on, lost or even.")
2200ENDPROC
2210DEFPROCerror
2220REPORT:PRINT" at line ";ERL
2230*FX12
2235A%=0:Z%=0:X%=0
2240VDU23,1,1;0;0;0;
2250ENDPROC
2260DEF PROCendprog
2270VDU23,1,1;0;0;0;
2280CLS:PRINTTAB(13,10)"BYE FROM ROY"
2290IFA%<1PRINTTAB(12,11)"SORRY YOU LOS
T"
2300IFA%>0PRINTTAB(9,11)"I'M GLAD THAT
YOU WON"
2310*FX12
2320A%=0:Z%=0:X%=0
2330END
2340ENDPROC