--- title: "Lotto" id: 72386 type: "computer_media" slug: "lotto-3" url: "http://localhost/computer_media/lotto-3/" markdown_url: "http://localhost/computer_media/lotto-3.md" published_at: "2026-10-23T07:47:10+00:00" modified_at: "2026-10-23T07:47:10+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/10/lottohill-1.png" excerpt: "Pick your lottery numbers by moving an arrow cursor around a grid of 1 to 44 and pressing ENTER, with repeated picks flagged and rejected." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Paul Hill" slug: "paul-hill" taxonomy: "indiv" url: "http://localhost/indiv/paul-hill/" genre: - name: "Gambling" slug: "gambling" taxonomy: "genre" url: "http://localhost/type/gambling/" media_contents: - id: 72439 title: "SINCUS Exchange Tape 104" type: "computer_media" url: "http://localhost/computer_media/sincus-exchange-tape-104/" media_type: "Program" programmers: - name: "Paul Hill" slug: "paul-hill" taxonomy: "indiv" url: "http://localhost/indiv/paul-hill/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Lotto%20%281985%29%28Hill%2C%20Paul%29%28TS2068%29%28US%29%28Program%29.zip" tsrun_member: "Lotto (1985)(Hill, Paul)(TS2068)(US)(Program)/Lotto (1985)(Hill, Paul)(TS2068)(US)(Program).tap" mediadate: "1985" images: - url: "http://localhost/wp-content/uploads/2026/10/lottohill-1.png" - url: "http://localhost/wp-content/uploads/2026/10/lottohill-2.png" related_content: - id: 24807 title: "Sinclair Computer Users Society (SINCUS)" type: "usergroup" url: "http://localhost/usergroup/sinclair-computer-users-society-sincus/" media_type_tags: "Gambling" license: false --- # Lotto 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 0` waits for a key, then `INKEY$` 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/PI` sets 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 206 ```