Ask Again
Right now the Oracle answers once and stops. Close the loop — clear the screen and GOTO back to the question — and it becomes something you consult, not something you run. Your finished Oracle.
There's one thing between this and a real fortune-teller: it answers once, then drops you back
at READY.. A fortune-teller you keep asking. So close the loop — after the answer, clear
the screen and go back to the question.
10 PRINT CHR$(147)
20 DIM A$(8)
30 A$(1)="IT IS CERTAIN"
40 A$(2)="THE SIGNS POINT TO YES"
50 A$(3)="WITHOUT DOUBT"
60 A$(4)="ASK AGAIN LATER"
70 A$(5)="CANNOT FORESEE IT NOW"
80 A$(6)="DO NOT COUNT ON IT"
90 A$(7)="MY REPLY IS NO"
100 A$(8)="OUTLOOK NOT SO GOOD"
110 POKE 54296,15
120 PRINT CHR$(147)
130 INPUT "SPEAK, MORTAL";Q$
140 R=INT(RND(1)*8)+1
150 PRINT
160 GOSUB 300
170 CO=5
180 IF R>=4 AND R<=5 THEN CO=7
190 IF R>=6 THEN CO=2
200 POKE 53280,CO:POKE 646,CO
210 PRINT A$(R)
220 POKE 646,14
230 FOR T=1 TO 1500:NEXT T
240 GOTO 120
300 POKE 54273,20:POKE 54272,0
310 POKE 54277,0:POKE 54278,240
320 POKE 54276,17
330 FOR T=1 TO 800:NEXT T
340 POKE 54276,16
350 RETURN
The new lines are at the bottom. After the answer prints, line 230 holds it on screen for a
moment (FOR T=1 TO 1500:NEXT — long enough to read), then line 240, GOTO 120, jumps back
up to clear the screen and ask again. The setup at the top — the DIM and the answers — runs
once; the loop goes back to line 120, after the array is built, so it never tries to
DIM twice.
That single GOTO is the difference between a program and a toy. One sitting now holds as
many questions as the player wants — ask, wait, read, ask again — the ceremony resetting each
time.
That's Oracle. A question taken with INPUT, an answer chosen from an array by RND, a
pause that builds suspense, a mood in colour, and a loop that never ends. The machine makes a
decision, and you never know what it will be.
Try this
- Pass it round. Hand the keyboard to someone and watch them ask it something real. The funny answers and the unlucky ones are why they keep going.
- A way out. Add a check after
INPUT—IF Q$="BYE" THEN END— so the player can dismiss the Oracle politely.
What's next
You've built a program that decides. Next in Volume 1 comes Reflex — the machine starts measuring, as you meet the C64's clock and learn to time the player to the jiffy.