--- title: "Super Slot-O" id: 57002 type: "computer_media" slug: "super-slot-o" url: "http://localhost/computer_media/super-slot-o/" markdown_url: "http://localhost/computer_media/super-slot-o.md" published_at: "2024-10-02T07:22:30+00:00" modified_at: "2026-04-03T07:58:45+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/26_Slot.png" excerpt: "Spin three random graphic characters and match them to win virtual cash in this vintage slot-machine simulator with a surprisingly clever character-selection algorithm." 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 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Game" slug: "game" taxonomy: "genre" url: "http://localhost/type/game/" media_contents: - id: 56732 title: "Timex Sinclair Public Domain Library Tape 1001" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1001/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/26_Slot.png" media_type_tags: "Game" --- # Super Slot-O This program simulates a one-armed bandit (slot machine) game called “Super Slot-O.” Each spin generates three random characters drawn from one of two pools: printable ASCII characters (codes 2–7, block graphics) or Spectrum-style graphic characters (codes 128–132), selected by a 50/50 RND branch at line 500. The three results are compared pairwise using flags P, Q, and R to detect matching pairs, and the combination of those flags determines whether the player wins $5 (two of a kind), $10 (three of a kind), or nothing. The game loops indefinitely with no bankroll tracking, initialising all flags via a GOSUB 900 subroutine before each spin. *** ## Program Analysis ### Program Structure The program is organised into a main loop and several subroutines: - **Lines 10–90:** Title display, instruction prompt (GOSUB 800), variable initialisation (GOSUB 900), and wait for a keypress. - **Lines 100–390:** Main game logic — three spins via GOSUB 500, pairwise comparison, result display, then loop back to line 20. - **Lines 500–720:** Random character generation subroutine with two branches. - **Lines 800–820:** Instruction text subroutine. - **Lines 900–960:** Variable reset subroutine. ### Character Generation Algorithm The subroutine at line 500 uses a binary RND branch to choose between two character pools: | Branch | Lines | Character range | Description | | --- | --- | --- | --- | | Lower (RND < 0.5) | 600–620 | CHR$ 2 – CHR$ 7 | Low block/graphic characters | | Upper (RND ≥ 0.5) | 700–720 | CHR$ 128 – CHR$ 132 | UDG / block graphic characters | The lower branch loops until `INT(8*RND)` yields a value ≥ 2 (giving codes 2–7). The upper branch loops until `INT(133*RND)` yields a value ≥ 128 (giving codes 128–132). Both branches use rejection sampling to avoid unwanted character codes. ### Win Condition Logic Three Boolean flags `P`, `Q`, and `R` record pairwise matches: `P` for A=B, `Q` for B=C, `R` for C=A. Their sum is then used to classify the result: - `P+Q+R = 1` → exactly one pair matches → “Two of a Kind” → $5 - `P+Q+R > 1` → two or three pairs match (i.e. all three equal) → “Three of a Kind” → $10 - `P+Q+R < 1` → no matches → no win Note that if all three values are equal, all three flags are set and their sum is 3, correctly triggering the three-of-a-kind branch. Two of a kind (exactly two symbols the same) sets exactly one or two flags depending on which pair matches; however since the three comparisons are not mutually exclusive, two matching symbols always set exactly one flag, making the logic sound in practice. ### Variable Initialisation The subroutine at lines 900–960 resets all six flags (`P`, `Q`, `R`, `S`, `T`, `U`) to zero before each spin. It is called once at startup (line 70) but the main loop at line 390 returns to line 20, skipping the GOSUB 900 call. This means the flags are *not* reset between rounds, which is a bug: a win on one round can carry its flag state into the next, causing incorrect win announcements. ### Key BASIC Idioms - Using `IF INKEY$="" THEN GOTO 90` (line 90) as a busy-wait keypress loop. - Using `IF flag THEN ...` directly as a Boolean test (lines 320–370), relying on non-zero being truthy. - `PAUSE 60` (line 310) inserts a one-second delay before displaying results. - `RAND` at line 6 seeds the random number generator for variety between runs. ### Bugs and Anomalies - **Missing flag reset in main loop:** GOSUB 900 is only called once before the first game. From line 390 the program jumps back to line 20, bypassing the reset. All six flags retain their previous values, corrupting subsequent win detection. - **No bankroll tracking:** Dollar amounts are printed but never accumulated or deducted; there is no concept of a starting stake or game-over condition. - **Cosmetic loop:** The star banner (lines 20–50) reprints on every loop iteration including mid-game redraws, which may cause screen clutter since `CLS` at line 100 only runs once after the initial keypress. ## Source Code ``` 5 REM SUPER SLOT-O 6 RAND 10 PRINT "PLAY SUPER SLOT-O" 20 FOR L=1 TO 17 30 PRINT "*"; 40 NEXT L 50 PRINT 60 GOSUB 800 70 GOSUB 900 90 IF INKEY$="" THEN GOTO 90 100 CLS 110 GOSUB 500 120 LET A=X 130 GOSUB 500 140 LET B=X 150 GOSUB 500 160 LET C=X 170 IF A=B THEN LET P=1 180 IF B=C THEN LET Q=1 190 IF C=A THEN LET R=1 200 PRINT 210 PRINT CHR$ A;" ";CHR$ B;" ";CHR$ C 220 IF P+Q+R=1 THEN LET S=1 230 IF P+Q+R>1 THEN LET T=1 240 IF P+Q+R<1 THEN LET U=1 300 PRINT 310 PAUSE 60 320 IF S THEN PRINT "TWO OF A KIND" 330 IF S THEN PRINT "YOU WIN $5" 340 IF T THEN PRINT "THREE OF A KIND" 350 IF T THEN PRINT "YOU WIN $10" 360 IF U THEN PRINT "SORRY, THERE IS NO MATCH" 370 IF U THEN PRINT "YOU DO NOT WIN ANY MONEY" 380 PRINT 390 GOTO 20 500 LET X=2*RND 510 IF X<1 THEN GOTO 600 520 GOTO 700 600 LET X=INT (8*RND) 610 IF X<2 THEN GOTO 600 620 RETURN 700 LET X=INT (133*RND) 710 IF X<128 THEN GOTO 700 720 RETURN 800 PRINT "PRESS ANY KEY TO" 810 PRINT "PULL THE SLOT MACHINE HANDLE" 820 RETURN 900 LET P=0 910 LET Q=0 920 LET R=0 930 LET S=0 940 LET T=0 950 LET U=0 960 RETURN 1000 SAVE "1002%6" 1010 RUN ```