Picks numbers for any lottery. You enter an upper limit from 10 to 99, how many numbers to draw (1 to 20), and whether you want a bonus number. Each pick flickers through four random values in a framed window at the top of the screen before it settles, then drops into a row of placeholder blocks below. No number is drawn twice, and the bonus number is chosen from those left over. When the draw is done, Y draws again with the same settings, C sends the screen to the printer with COPY, and Q quits.
No author is named. A REM at the top calls it a generic lottery program adapted from “Munchers” by Yin Chiu and Henry Mullish.
Program Analysis
Structure
- Lines 100–180:
DIM N(99)and the three set-up prompts, each re-asked until the answer is in range. - Lines 200–370: clear the drawn-number flags, draw the window and placeholders (subroutine 2000), then pick each number.
- Lines 380–410: the optional bonus number.
- Lines 450–480: the again/copy/quit loop.
- Lines 1000–1020: clear the screen and print the LOTTERY title. Lines 2000–2140 draw the window and placeholder blocks. Lines 3000–3110 place each number on row 12 (numbers 1–10) or row 14 (numbers 11–20).
The draw
The inner loop at lines 300–350 runs five times per number. Every value it shows must be unused, but only the fifth is marked in N() and kept. The first four are just the animation in the window. The row of numbers is centred by working out its width (H*2+(H-1)) in line 2100.
Notable Techniques
- An array of flags,
N(1)toN(MAX), rejects repeats without searching the list of numbers already drawn. - The window is drawn with block-graphic corner and edge characters in lines 2000–2020.
- The end-of-draw menu polls
INKEY$in a tight loop and callsCOPYfor a printed copy.
Potential Issues
- Lines 2070 and 2120 print the placeholder block at a fixed column (
AT 14,1andAT 12,X+1) instead of stepping with the loop variableI, so only one placeholder is drawn on each row. - Drawing ten or more numbers appears to fail. For 10 numbers,
Xis never set on a first run, so line 3010 should stop with “Variable not found”. For 11 to 18,Xis centred for the numbers left over after ten (H=Q-10), but the first ten still go on row 12 fromX, and the tenth lands past column 31. Only 19 and 20, and counts below ten, appear to fit. - Each key test in lines 452–456 reads
INKEY$again, so a key can be missed if it is released between tests.
This program came from an Oliger (JLO SAFE) disk and was converted to load from tape. The disk-specific SAVE / in line 9998 became a plain SAVE, and the program now autostarts at line 10. It was tested in ZEsarUX, drawing six numbers from 49 with a bonus number.
Source Code
10 REM Lottery
20 REM This is a generic lottery program that will allow you to choose a number range and quantity as well as include a bonus number for those lottery systems that use bonus numbers. This program is adapted from Munchers by Yin Chiu and Henry Mullish.
100 DIM N(99)
110 GO SUB 1000
120 PRINT AT 10,4;"Enter Upper Limit 10-99"
130 INPUT MAX
135 IF MAX>99 OR MAX<10 THEN GO TO 120
140 PRINT AT 10,4;"How Many Numbers? 1-20"
150 INPUT Q
155 IF Q>MAX OR Q<1 OR Q>20 THEN GO TO 140
160 PRINT AT 10,1;"Do you require a Bonus Number?"
170 PRINT AT 11,9;"Type Y or N"
180 INPUT B$
200 FOR I=1 TO MAX
210 LET N(I)=0
220 NEXT I
230 GO SUB 1000
240 GO SUB 2000
290 FOR I=1 TO Q
300 FOR K=1 TO 5
310 LET Z=INT (RND*MAX)+1
320 IF N(Z)=1 THEN GO TO 310
330 IF K=5 THEN LET N(Z)=1
340 PRINT AT 7,14;Z;" "
350 NEXT K
355 PRINT AT 7,14;" "
360 GO SUB 3000
370 NEXT I
380 IF B$="N" OR B$="n" THEN GO TO 450
390 LET Z=INT (RND*MAX)+1
400 IF N(Z)=1 THEN GO TO 390
410 PRINT AT 16,13;"Bonus";AT 17,15;Z
450 PRINT AT 18,0;"Enter Y to run again";TAB 0;" C to print a hard copy";TAB 0;" Q to quit"
452 IF INKEY$="Y" OR INKEY$="y" THEN GO TO 200
454 IF INKEY$="C" OR INKEY$="c" THEN COPY
456 IF INKEY$="Q" OR INKEY$="q" THEN GO TO 480
458 GO TO 452
480 STOP
1000 CLS
1010 PRINT AT 1,12;"LOTTERY";AT 2,12;"-------"
1020 RETURN
2000 PRINT AT 6,13;":'''''''':"
2010 PRINT AT 7,13;": :"
2020 PRINT AT 8,13;":........:"
2030 LET H=Q
2040 IF H<10 THEN GO TO 2100
2050 LET H=H-10
2060 FOR I=1 TO 28 STEP 3
2070 PRINT AT 14,1;"::::"
2080 NEXT I
2090 IF H=0 THEN RETURN
2100 LET X=INT ((31-(H*2+(H-1)))/2)
2110 FOR I=1 TO (H*2+(H-2)) STEP 3
2120 PRINT AT 12,X+1;"::::"
2130 NEXT I
2140 RETURN
3000 IF I>10 THEN GO TO 3100
3010 PRINT AT 12,X+((I-1)*3+1);Z;" "
3020 RETURN
3100 PRINT AT 14,(I-11)*3+1;Z;" "
3110 RETURN
9998 SAVE /"LOTTO"Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

