LOTTO draws a flashing chequered border and asks how many lines to pick, from one to ten. For each line it chooses six different numbers from 1 to 44 and prints them in ascending order, with a beep, then wishes the player good luck. The column explains how to change the range and the number of picks for other state lotteries: the range is in lines 40, 60 and 120 and the number of picks in lines 50 and 130.
It ran in Michael J. DiRienzo’s Mike’s Notebook column of August 1990.
Program Analysis
- Lines 1–5 draw the border with block graphics
CHR$ 143andCHR$ 128, printed withFLASH 1. - Lines 40–90 mark six distinct random numbers in the array
s(44), repicking any number already used. - Lines 110–140 scan the array in order, so the numbers come out sorted without a sort routine.
Notable Techniques
DIM s(44)is re-executed for each line, which clears the flags."," AND c<6prints a comma after every number except the sixth.
Typed in from the Mike’s Notebook column on RMG Enterprises’ monthly RMG UPDATES disk for August 1990, where the program exists only as a listing in the column’s text. It was tokenized for tape and tested in ZEsarUX.
Source Code
1 BORDER 4: PAPER 0: CLS : PAPER 1: INK 6
2 FOR x=0 TO 31 STEP 2
3 PRINT FLASH 1;AT 0,x;CHR$ 143;CHR$ 128;AT 21,30-x;CHR$ 128;CHR$ 143
4 IF x<22 THEN PRINT FLASH 1;AT x,0;CHR$ 143;AT x+1,0;CHR$ 128;AT 20-x,31;CHR$ 128;AT 20-x+1,31;CHR$ 143
5 NEXT x
10 RANDOMIZE : PAPER 0: INK 7
20 INPUT "How Many Lines (1-10)? ";q: IF q>10 THEN GO TO 20
30 FOR g=1 TO q
40 DIM s(44)
50 FOR n=1 TO 6
60 LET a=1+INT (RND*44)
70 IF NOT s(a) THEN LET s(a)=a: GO TO 90
80 GO TO 60
90 NEXT n
100 PRINT AT g*2,5;"(";g;") ";
110 LET c=0
120 FOR n=1 TO 44
130 IF s(n) THEN LET c=c+1: PRINT s(n);"," AND c<6;
140 NEXT n
150 BEEP .01,20: PRINT ''
160 NEXT g: PRINT #1;AT 1,10;"Good Luck!!"
170 PAUSE 0: STOPNote: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
