Skip to content
Game 2 Unit 2 of 6 1 hr learning time

The Oracle Chooses

Replace the one fixed answer with one of two, picked at random. RND rolls a number, ON…GOTO branches on it, and the player stops knowing which answer is coming — that gap is chance.

33% of Oracle

An Oracle that always says the same thing is a broken clock. To surprise the player, it has to choose — and a machine chooses with RND, a random number. Roll one, and branch on it.

10 PRINT CHR$(147)
20 INPUT "SPEAK, MORTAL";Q$
30 R=INT(RND(1)*2)+1
40 PRINT
50 ON R GOTO 60,80
60 PRINT "WITHOUT DOUBT"
70 GOTO 100
80 PRINT "ABSOLUTELY NOT"
100 END
A C64 screen: SPEAK, MORTAL? WILL IT WORK, then WITHOUT DOUBT.
RND picks 1 or 2; ON R GOTO sends the program to one answer or the other. Run it again on the same question and you may get the opposite.

R = INT(RND(1)*2)+1 rolls a number. RND(1) gives a fraction between 0 and 1; times 2 spreads it across two values; INT chops off the fraction; +1 shifts it so R is 1 or 2. Then ON R GOTO 60,80 is a switch: if R is 1 it jumps to line 60, if R is 2 to line 80 — one answer each.

Here's the quiet magic: you wrote both answers, but the player doesn't know which is coming. That gap between what you wrote and what they get is chance — the thing that makes the Oracle feel alive instead of scripted.

Try this

  • Give the two answers personality. "WITHOUT DOUBT" against "ABSOLUTELY NOT" beats a bare YES/NO — opposites with attitude.
  • Watch the gap. Ask the same question five times. Same words from you, different fate from the machine.

What's next

Two answers run dry fast. In Unit 3 the Oracle gets a whole list — eight replies in a string array, and RND reaching in to pick one.