--- title: "Inducto" id: 57425 type: "computer_media" slug: "inducto" url: "http://localhost/computer_media/inducto/" markdown_url: "http://localhost/computer_media/inducto.md" published_at: "2024-10-05T13:15:55+00:00" modified_at: "2026-03-30T21:18:02+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/226_Indu.png" excerpt: "A number-guessing game with a twist: instead of \"higher/lower,\" you get a mathematical clue — the square root of how far off your guess was." 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: 56736 title: "Timex Sinclair Public Domain Library Tape 1005" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1005/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/226_Indu.png" media_type_tags: "Game" --- # Inducto INDUCTO is a number-guessing game that picks a secret integer between 1 and 20 and gives the player up to 10 attempts to identify it. After each wrong guess, instead of a simple “higher/lower” hint, the program reveals the square root of the absolute difference between the guess and the target, providing a scaled numeric clue. Line 20 uses a RND>RND comparison to introduce a probabilistic bias, giving a roughly 50% chance of re-rolling the target before play begins. The SCROLL command is used throughout to manage the limited display, keeping output readable on the small screen. *** ## Program Analysis ### Program Structure The program is compact at 13 executable lines. Control flow is straightforward: a setup phase (lines 10–20), a guessing loop (lines 30–100), and a resolution phase (lines 110–150). 1. **Lines 10–20:** Generate the secret number `A` as a random integer 1–20. Line 20 re-rolls with roughly 50% probability. 2. **Lines 30–100:** A `FOR` loop over up to 10 guesses. Each iteration scrolls, prompts, reads input, and either branches to the win condition or prints a clue. 3. **Lines 110–150:** Print the answer, detect win vs. loss, and display the win message or `STOP`. 4. **Lines 160–170:**`SAVE` followed by `RUN` for tape storage and restart. ### The RND>RND Re-roll (Line 20) Line 20 reads `IF RND>RND THEN GOTO 10`. Because two independent `RND` calls are evaluated, there is approximately a 50% chance of looping back to re-generate `A`. This does not produce a uniform distribution over iterations — it simply adds a non-deterministic delay before play starts, and the final value of `A` is still uniformly drawn from 1–20. It does not improve randomness in any meaningful way but is a common idiom seen in early BASIC games. ### The Clue Mechanic Line 90 is the most distinctive feature of the game: `PRINT "WRONG ";C,"CLUE- ";SQR(ABS(A-C))` Rather than a binary higher/lower hint, the player receives `SQR(ABS(A-C))` — the square root of the absolute difference. For a range of 1–20, the maximum possible raw difference is 19, giving a maximum clue of approximately 4.36. This compresses the hint into a non-linear scale, making nearby misses hard to distinguish from each other (e.g., a difference of 1 yields clue 1.0, while a difference of 4 yields only 2.0), which increases difficulty compared to a direct difference hint. ### Win/Loss Detection When the correct answer is entered, line 80 jumps to line 110, bypassing `NEXT B`. At line 130, the condition `C<>A` catches the case where the loop exhausted all 10 guesses without a correct answer — in that path `C` still holds the last (wrong) guess, so `STOP` is executed. If the player won, `C=A` and execution falls through to line 140, which prints the congratulatory message including `B`, the guess number on which they succeeded. Note the deliberate zero in `"W0W"` (digit zero, not letter O) — a common typographical quirk in early BASIC listings. ### Display Management `SCROLL` is called at lines 40, 70, and 110 to advance the display before printing, preventing the “scroll?” prompt from interrupting gameplay on the ZX81’s 24-line limit. ### Notable Anomalies - Line 120 ends with a trailing comma: `PRINT A,`. This positions the cursor at the next print zone rather than a new line, so the win message on line 140 prints on the same line as the revealed answer — a minor layout quirk. - In the loss path (loop exhausted), `A` is printed at line 120 but the player’s last guess `C` is not re-displayed, which is slightly inconsistent with the win path where `B` is shown. - The `RND>RND` idiom at line 20 is probabilistically inelegant; a simple `GOTO 10` with no condition, or no re-roll at all, would be functionally equivalent for randomness quality. ### Variable Summary | Variable | Purpose | | --- | --- | | `A` | The secret target number (1–20) | | `B` | Current guess number (loop counter, 1–10) | | `C` | Player’s current guess (INPUT) | ## Source Code ``` 5 REM "INDUCTO" 10 LET A=INT (RND*20)+1 20 IF RND>RND THEN GOTO 10 30 FOR B=1 TO 10 40 SCROLL 50 PRINT "GUESS NO. ";B 60 INPUT C 70 SCROLL 80 IF C=A THEN GOTO 110 90 PRINT "WRONG ";C,"CLUE- ";SQR (ABS (A-C)) 100 NEXT B 110 SCROLL 120 PRINT A, 130 IF C<>A THEN STOP 140 PRINT "W0W,YOU GOT IT MAN";B 150 STOP 160 SAVE "1022%6" 170 RUN ```