Decisions

Developer(s): Roger Valentine
Date: 1983
Type: Program
Platform(s): TS 2068

Decisions is a light-hearted fortune-telling program in the spirit of a magic 8-ball. You type any question and the computer answers at random with one of nine replies, from YES, NO and MAYBE to HOW SHOULD I KNOW, THAT IS UP TO YOU and I GIVE UP – WHAT DO YOU THINK?. The tenth possibility is a pause in which it announces THIS IS TRICKY…LET ME THINK… before answering. It then asks whether you are satisfied: answer N and it tries again, otherwise it asks ANYMORE?, where Y starts over and anything else ends the session with O.K.BYE.

The program is from Roger Valentine’s book What Can I Do With My Timex Sinclair 1000? Lots! (Wiley, 1983), where it appears in the “Fate and Fortune” chapter; the REM in line 1 names the book. It was written in TS1000 BASIC and runs unchanged as TS2068 BASIC. Valentine says the idea came from a swinging-pendulum executive toy.

Program Analysis

Program Structure

Line 5 dimensions Q$ to a single character. Lines 15–25 take the question, rejecting an empty entry. Lines 30–85 pick X from 1 to 10 and print the matching reply through a chain of IF lines. Lines 100–135 ask for satisfaction and another round, and lines 200–215 are the “thinking” delay for X=10.

Notable Techniques

  • DIM Q$(1) fixes the string at one character, so a question of any length costs no memory and only the first letter of each answer is tested. The book notes this as a technique for programs that act only on the first letter of the input.
  • The delay loop FOR X=100 TO 10 STEP -1 leaves X at 9 when it ends. Line 35 then picks from 1 to 9, so the “thinking” option cannot come up twice in a row. The book prefers the loop to PAUSE because of screen flicker on the TS1000.
  • Line 135 prints the undefined variable Z on purpose. The book explains that this stops the program with report 2 (variable not found) at line 135 instead of a STOP.

Potential Issues

  • Replies are compared with capital N and Y. On the TS1000 everything is typed in capitals, but on the TS2068 a lower-case n or y is not recognised, so CAPS LOCK should be on.
  • There is no RANDOMIZE, so after loading the random sequence always starts the same way and the first answer is always YES.

This copy came from one of Don Lambert’s Oliger (JLO SAFE) disks. The only change for tape was removing the Oliger “/” from the SAVE at line 230 and setting the program to autorun. It was tested in ZEsarUX on an emulated TS2068.

Image Gallery

Source Code

    1 REM "DECISIONS" WHAT CAN I DO WITH MY T/S1000
    5 DIM Q$(1)
   15 PRINT "ASK ANY QUESTION"
   20 INPUT Q$
   25 IF Q$=" " THEN GO TO 20
   30 LET X=10
   35 CLS 
   40 LET X=INT (RND*X)+1
   45 IF X=1 THEN PRINT "YES"
   50 IF X=2 THEN PRINT "NO"
   55 IF X=3 THEN PRINT "MAYBE"
   60 IF X=4 THEN PRINT "HOW SHOULD I KNOW"
   65 IF X=5 THEN PRINT "NEVER"
   70 IF X=6 THEN PRINT "OF COURSE"
   75 IF X=7 THEN PRINT "THAT IS UP TO YOU"
   80 IF X=8 THEN PRINT "POSSIBLY"
   85 IF X=9 THEN PRINT "I GIVE UP - WHAT DO YOU THINK?"
   90 PRINT 
   95 IF X=10 THEN GO TO 200
  100 PRINT "ARE YOU SATISFIED WITH MY REPLY"
  105 INPUT Q$
  110 IF Q$="N" THEN GO TO 30
  115 CLS 
  120 PRINT "ANYMORE?"
  125 INPUT Q$
  130 IF Q$="Y" THEN RUN 
  135 PRINT "O.K.BYE";Z
  200 PRINT "THIS IS TRICKY...LET ME THINK..."
  205 FOR X=100 TO 10 STEP -1
  210 NEXT X
  215 GO TO 35
  220 STOP 
  230 SAVE "DECISION?"

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.