29
Guess the number
Assume you wish to guess a randomly chosen number between 1 and 1000.
Simple guessing will require, on average, 500 tries to find the answer.
This program will tell you if your guess is larger or smaller than a number (which it chooses),
so that, proceeding logically, it should be possible to find the answer within 11 attempts.
1000 Ran #+ l → X:?→ A:0→ D:Lbl 1:D +1→ D:A = X ⇒ Goto
3 : X > A ⇒ Goto 2 : ?→ A : Goto 1 : Lbl 2 : ?→ B : B → A : Goto 1 :
Lbl 3:X
Prog
1
Enter a random number and press
If the answer is smaller than the number you entered,
"A?" will be displayed.
If the answer is larger than the number you entered,
"B?" will be displayed.
When the number you enter is the correct answer,
"X" will be displayed, along with the answer
ff
and the number of attempts made.
D < 68 STEP >
EXE
.
S A
S A
S A
S A
P1 P1 P2 P3 P4
R
G
P1 P1 P2 P3 P4
R
G
P1 P1 P2 P3 P4
R
G
Disp
P1 P1 P2 P3 P4
R
G
Disp
41