--- title: "Number Juggle 1" id: 57023 type: "computer_media" slug: "number-juggle-1" url: "http://localhost/computer_media/number-juggle-1/" markdown_url: "http://localhost/computer_media/number-juggle-1.md" published_at: "2024-10-02T07:45:22+00:00" modified_at: "2026-03-30T21:20:04+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/47_Num.png" excerpt: "A number-guessing trick that walks the player through doubling, adding, and subtracting, then seemingly reads their mind to reveal the original number." 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/47_Num.png" media_type_tags: "Game" --- # Number Juggle 1 This program is a classic “number mind-reading” trick that guides a player through a sequence of arithmetic operations and then reveals the number they originally thought of. The player is asked to think of a number, double it, add five, subtract seven, and enter the result; the program then recovers the original number using the inverse formula K = (A + 2) / 2. Input is collected via two INPUT statements: one for the player’s name (A$) and one for the computed result (A). *** ## Program Analysis ### Program Structure The program follows a straightforward linear flow with no loops or subroutines. It can be divided into four phases: 1. **Introduction** (lines 10–40): Displays a title in inverse video, prompts for the player’s name, and stores it in `A$`. 2. **Instruction sequence** (lines 65–140): Uses `CLS` and `PAUSE 400` to pace three successive on-screen instructions — double it, add five, subtract seven — creating the illusion of a controlled, dramatic reveal. 3. **Calculation and reveal** (lines 145–185): Accepts the player’s result as `A`, computes the original number as `K`, and displays it. 4. **Save/auto-run footer** (lines 300–410): Stops normal execution, then saves the program with an auto-run flag, followed by `RUN` for re-entry. ### The Mathematics The trick relies on a deterministic arithmetic chain. If the player’s secret number is *n*, the operations are: - Double it: *2n* - Add five: *2n + 5* - Subtract seven: *2n + 5 − 7 = 2n − 2* The player types *2n − 2* as `A`. The program then computes `K = (A + 2) / 2`, which simplifies to `(2n − 2 + 2) / 2 = n`, correctly recovering the original number. ### Key BASIC Idioms Several idiomatic patterns appear throughout the listing: - The title at line 10 is printed entirely in inverse video using `%`-escaped characters, a common technique for visual emphasis without machine code. - `PAUSE 400` (approximately 16 seconds at 50 Hz) is used twice to give the player time to perform the mental arithmetic before the screen is cleared and the next instruction shown. - Line 135 uses `A$;,,"SUBTRACT SEVEN"`, placing the instruction text in the third print zone by supplying two commas, creating an indented appearance for variety. - Line 75 uses a leading comma (`,"DOUBLE IT"`) to push the text to the second print zone, adding visual alignment. ### Variable Usage | Variable | Purpose | | --- | --- | | `A$` | Player’s name, used throughout for personalised prompts | | `A` | The result entered by the player after completing the arithmetic | | `K` | The recovered original number, computed as `(A+2)/2` | ### Notable Anomalies Line numbering is irregular and non-sequential in places (10, 12, 30, 40, 65, 70, 75, 95, 100, …), suggesting the program was edited incrementally with lines inserted between existing ones. There are notable gaps — for instance between lines 185 and 300 — which may indicate deleted or planned content. The `STOP` at line 300 ensures that the `SAVE`/`RUN` block at lines 400–410 is only reached during tape saving, not during normal gameplay execution. ## Source Code ``` 10 PRINT "%N%U%M%B%E%R% %J%U%G%G%L%E" 12 PRINT 30 PRINT "NAME OF PLAYER" 40 INPUT A$ 65 CLS 70 PRINT A$;", THINK OF A NUMBER AND" 75 PRINT ,"DOUBLE IT" 95 PAUSE 400 100 CLS 120 PRINT A$;",ADD FIVE" 125 PAUSE 400 130 CLS 135 PRINT A$;,,"SUBTRACT SEVEN" 140 PRINT "AND TYPE IN THE RESULT" 145 INPUT A 150 CLS 175 LET K=(A+2)/2 185 PRINT "YOUR NUMBER, ";A$,",WAS ";K 300 STOP 400 SAVE "1004%7" 410 RUN ```