Number Juggle 2 is a two-player mind-reading trick program that instructs each player to perform a secret sequence of arithmetic operations on a chosen number, then apparently deduces the original numbers from the final results. Each player enters their transformed value, and the program reverses the operations algebraically: player A’s number is recovered as (A+2)/2 and player B’s as ((B+4)/3)-6. The program uses PAUSE 40000 as a long delay to give players time to perform the mental arithmetic steps away from the screen. A RETURN at line 260 without a preceding GOSUB suggests the program was designed to be called as a subroutine from a menu loader.
Program Analysis
Program Structure
The program flows linearly through four phases: setup (lines 10–65), instruction display with pauses (lines 70–165), result calculation and display (lines 170–205), and replay/exit handling (lines 210–260). Line 290 is a SAVE with an auto-run flag, and line 300 (RUN) would restart the program if reached in normal execution, though it is never reached in the normal flow.
- Lines 10–65: Title display, collect player names into
A$andB$. - Lines 70–165: Sequential instructions to both players, using
PAUSE 40000to allow off-screen mental arithmetic. Players input their transformed values intoAandB. - Lines 175–195: Algebraic reversal and display of original numbers.
- Lines 200–215: Replay prompt; if
Z$="YES", jumps back to line 65 to restart with the same names. - Lines 220–260: Farewell message, short pause, clear screen, then
RETURN.
The Mathematical Trick
Each player performs a fixed sequence of operations on their secret number. The program then inverts those operations exactly:
| Player | Operations applied | Reversal formula |
|---|---|---|
A (A$) | ×2, then −7, then −5 (wait — see below) | (A+2)/2 |
B (B$) | +6, then ×3, then −4 | ((B+4)/3)−6 |
For player A: they double their number (×2), then later add 5, giving 2n+5. They subtract 7, yielding 2n−2. The reversal (A+2)/2 = (2n−2+2)/2 = n is correct.
For player B: they add 6 (n+6), multiply by 3 (3n+18), subtract 4 (3n+14). The reversal ((B+4)/3)−6 = ((3n+14+4)/3)−6 = (3n+18)/3−6 = n+6−6 = n is correct.
Notable Techniques
- PAUSE 40000: Used at lines 95 and 125 as a very long delay (approximately 11 minutes on real hardware), effectively halting the program while players mentally compute their results without the other player seeing the screen. In practice the keypress would resume it early.
- Shared name variables across replay: The
GOTO 65at line 215 skips the name-input section (lines 30–60), reusingA$andB$for another round — a deliberate and clean optimisation. - RETURN without GOSUB: Line 260 contains a bare
RETURN, indicating this program was intended to be called as a subroutine from an external menu or loader program rather than run standalone. Reaching it in standalone mode would cause an error. - Inverse-video title: Line 10 uses inverse-video characters to render the title
NUMBER JUGGLE--2-2-prominently without any additional PRINT AT or INK commands. - Line number gap at 230: Lines jump from 225 to 240, skipping 230, suggesting a line may have been deleted during editing.
Bugs and Anomalies
- The
RETURNat line 260 with no correspondingGOSUBin this listing will cause a RETURN without GOSUB error if the program is run standalone rather than called from a loader. - Both players’ instructions are displayed on the same screen simultaneously (lines 70–90), meaning each can read the other’s instructions before the
PAUSE. This is a minor design issue, but since both operation sequences are fixed regardless of the number chosen, it does not break the trick. - Player A is told to add 5 (line 120) between the two
PAUSEscreens — the sequencing of instructions across two CLS sections means the full operation chain for A is split, which could cause confusion but is arithmetically consistent with the reversal at line 175.
Content
Source Code
10 PRINT "%N%U%M%B%E%R% %J%U%G%G%L%E%-%-%2%-%-"
25 PRINT
30 PRINT "NAME OF FIRST PLAYER?"
40 INPUT A$
45 PRINT
50 PRINT "NAME OF SECOND PLAYER?"
60 INPUT B$
65 CLS
70 PRINT A$;", THINK OF A NUMBER AND"
75 PRINT ,"DOUBLE IT"
80 PRINT
85 PRINT B$;", THINK OF A NUMBER AS WELL"
90 PRINT "AND ADD SIX TO IT"
95 PAUSE 40000
100 CLS
105 PRINT B$;", I WANT YOU TO MULTIPLY YOUR"
110 PRINT "NUMBER BY THREE"
115 PRINT
120 PRINT A$;", ADD FIVE"
125 PAUSE 40000
130 CLS
135 PRINT A$;", SUBTRACT SEVEN"
140 PRINT "AND TYPE IN THE RESULT"
145 INPUT A
150 CLS
155 PRINT B$;", I WANT YOU TO SUBTRACT"
160 PRINT "FOUR THEN TYPE IN YOUR RESULT"
165 INPUT B
170 CLS
175 LET K=(A+2)/2
180 LET L=((B+4)/3)-6
185 PRINT "YOUR NUMBER, ";A$;", WAS ";K
190 PRINT
195 PRINT "AND YOURS, ";B$;", WAS ";L
200 PRINT ,"ANOTHER TRY??"
205 INPUT Z$
210 CLS
215 IF Z$="YES" THEN GOTO 65
220 PRINT "OK, ";A$;" AND ";B$;", THANKS"
225 PRINT "FOR PLAYING..GOOD-BYE"
240 PAUSE 150
250 CLS
260 RETURN
290 SAVE "1004%8"
300 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
