Skip to content

Choose an answer

Give Oracle Stone three responses and let chance choose between them.

Oracle Stone offers an answer to a question. It does not understand the question: we write its possible replies, and chance chooses one. That makes it a playful writing toy, not a source of advice for important decisions.

Save Lucky Number if it is still in memory, then reset the Spectrum before starting. Old numbered lines would otherwise remain in the new program. Use the same 48K setup and Host Keyboard mode.

Write three possible replies

Enter this new program:

10 PAPER 0
20 INK 7
30 BORDER 0
40 CLS
50 PRINT "ORACLE STONE"
60 INPUT "Ask a question: ";q$
70 LET answer=INT (RND*3)+1
80 CLS
90 PRINT "THE STONE SAYS"
100 IF answer=1 THEN PRINT "Try a small experiment."
110 IF answer=2 THEN PRINT "Ask someone to join you."
120 IF answer=3 THEN PRINT "Take a different route."

Lines 10–40 select white text on black and clear the display. Lines 50–60 show the title and wait for a question. q$ stores the entered text. No later line examines it: the question is an invitation to imagine a response, not data our program interprets.

Line 70 chooses 1, 2 or 3. Multiplying RND by 3 gives a value from zero to less than three; INT rounds it down to 0, 1 or 2; adding one gives our choices. Choose a new secret develops this expression and explains its key entry.

Each IF checks the same stored answer. Only one can match. The remaining tests still run, but their PRINT statements are skipped. Enter IF with U, THEN with left Option/Alt+G, and PRINT with P after THEN. Foundations: Making a Choice traces this idea without tying it to Sinclair BASIC’s syntax.

The colour keywords use extended mode: press and release Shift+left Option/Alt, then left Option/Alt+C for PAPER or left Option/Alt+X for INK. BORDER is B and CLS is V after a line number. These values select a readable screen, not different outcomes.

Run it and enter a question. Expect one answer. To check the writing rather than wait for chance, temporarily set line 70 to 70 LET answer=1, then test 2 and 3 in separate runs. Restore the random expression afterwards.

Give the answer its own appearance

Add lines 5, 95 and 130:

5 RANDOMIZE
10 PAPER 0
20 INK 7
30 BORDER 0
40 CLS
50 PRINT "ORACLE STONE"
60 INPUT "Ask a question: ";q$
70 LET answer=INT (RND*3)+1
80 CLS
90 PRINT "THE STONE SAYS"
95 INK 6
100 IF answer=1 THEN PRINT "Try a small experiment."
110 IF answer=2 THEN PRINT "Ask someone to join you."
120 IF answer=3 THEN PRINT "Take a different route."
130 INK 7

RANDOMIZE at line 5 starts the sequence from the machine’s running frame counter; enter it with T after the line number. We do this once each run, rather than before each comparison. Repeated replies remain possible.

INK 6 makes the reply yellow. INK 7 afterwards restores white for later printing. Already printed words keep their colour. A colour choice can separate a heading from an answer, but the heading also says what the text means.

Oracle Stone displays one authored response beneath THE STONE SAYS.
Oracle Stone displays one authored response beneath THE STONE SAYS.

Try three replies of your own. Keep them short enough to read comfortably and suitable for someone who may take the toy literally. A concrete invitation such as “Draw your idea first” gives someone more to do than a mysterious verdict.

Would asking the same question twice guarantee the same answer?

No. The program stores the question, then chooses with RND. It never compares questions or remembers an earlier reply. The same question may get a different answer; different questions may get the same one.

Change only one reply and force its choice again. This separates testing the selection logic from judging the writing. When both work, restore line 70 and save this version as oracle before we change how its answer arrives.

Next, Give the answer a rhythm continues this program.

Sources

Steven Vickers, edited by Robin Bradbeer, ZX Spectrum BASIC Programming, second edition (Sinclair Research, 1983), chapters 2–3, input and conditions; chapter 11, pp. 73–75; chapter 16, pp. 111–116.