Picks six lottery numbers from a grid of 1 to 44. The numbers are printed in four rows of eleven, and an arrow cursor moves under them with the cursor keys 5–8. ENTER takes the number above the cursor, highlights it in the grid and adds it to the “Your pick of Lotto numbers” line. Choosing a number twice flashes REPEAT and asks again. The program runs two sets of six and then stops.
A REM credits Paul Hill of Johnson City, New York, February 1985, and names SINCUS. The same program is also on a SINCUS exchange-tape disk.
Program Analysis
Structure
- Lines 10–70: fill
m(4,11)with the numbers 1 to 44. - Lines 104–170: print the grid on rows 2, 4, 6 and 8, three columns per number.
- Lines 202–292: the cursor loop.
PAUSE 0waits for a key, thenINKEY$is read while the key is still down to move the cursor or catch ENTER. - Lines 300–360: store the pick in
s$(6,2), check it against the earlier picks (subroutine 400) and show it. - Lines 365–390: clear the screen and run the second set, then
STOP.
Picking a number
Line 340 turns the cursor position back into an array index: the row is (r-1)/2 and the column is c/30*10+1, which is c/3+1 for the three-character spacing.
Notable Techniques
- Cursor movement uses Boolean arithmetic, such as
LET c=c+3*((INKEY$="8" AND c<30)-(INKEY$="5" AND c>0)). LET n=PI/PIsets n to 1 without a numeric literal.
Potential Issues
- Line 490 jumps to line 206, which does not exist, so execution carries on at line 220 and reprints the prompt. It works, but only by accident.
- Only the first set of numbers stays on screen long enough to read. The screen is cleared as soon as the sixth pick of a set is made.
This program came from an Oliger (JLO SAFE) disk, a copy of the SNUG library disk 13/14, and was converted to load from tape. The program needed no changes other than its autostart line. It was tested in ZEsarUX, picking a set of numbers.
Source Code
2 REM "Lotto by PaulHill,Feb. 1985 Johnson City,NY (SINCUS)
5 CLS
8 REM ++set array of 44++
10 DIM m(4,11)
15 LET n=PI/PI
20 FOR a=1 TO 4
30 FOR b=1 TO 11
40 LET m(a,b)=n
50 LET n=n+1
60 NEXT b
70 NEXT a
100 REM ++place numbers++
104 FOR t=1 TO 2
105 LET r=2
120 FOR a=1 TO 4
125 LET c=0
130 FOR b=1 TO 11
140 PRINT AT r,c;m(a,b)
143 LET c=c+3
148 IF c>31 THEN LET c=0
150 NEXT b
160 LET r=r+2
170 NEXT a
200 REM ++move cursor "^"++
202 DIM s$(6,2)
205 FOR s=1 TO 6
220 PRINT AT 19,0;"Use Arrow KEYS to move cursor-^"
225 PRINT """ENTER"" KEY to select number"
280 LET r=3: LET c=0: LET a$="^"
281 PRINT AT r,c;a$: PAUSE 0: PRINT AT r,c;" "
282 LET c=c+3*((INKEY$="8" AND c<30)-(INKEY$="5" AND c>0))
284 LET r=r+2*((INKEY$="6" AND r<9)-(INKEY$="7" AND r>3))
289 IF INKEY$=CHR$ 13 THEN GO TO 300
292 GO TO 281
300 REM ++save number in s$++
320 PRINT AT r,c;a$
340 LET s$(s, TO 2)=STR$ m((r-1)/2,(c/30*10+1))
342 IF s>=2 THEN GO SUB 400
345 PRINT AT 15,0; INVERSE 1;"Your pick of Lotto numbers"
350 PRINT AT 16,s*3;s$(s, TO 2);" ";
352 PRINT AT r-1,c; BRIGHT 1; INVERSE 1;s$(s, TO 2)
355 PRINT AT r,c;" "
356 LET r=3: LET c=0
360 NEXT s
365 CLS
370 NEXT t
390 STOP
400 REM ++chek for repete++
410 FOR w=1 TO s-1
420 IF s$(s, TO 2)=s$(w, TO 2) THEN GO TO 450
430 NEXT w
440 RETURN
450 REM ++ reset for repete ++
460 PRINT AT r,c;" "
470 PRINT FLASH 1;AT 15,13;"REPEAT"
490 GO TO 206Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

