Solar System Review

Developer(s): Joan Kealy
Date: 198x
Type: Program
Platform(s): TS 2068
Tags: Education

A quiz that reviews the solar system. It asks 25 questions in random order, on astronomers such as Ptolemy, Copernicus, Kepler and Galileo, the North Star, the Earth’s orbit and rotation, light speed and the astronomical unit. Answers are typed in full; the opening screen warns that first and last names are expected and initials won’t do. A right answer shows YOU’RE RIGHT! and a wrong one shows SORRY! with the correct answer. At the end the program gives the number missed and a grade out of 100, with four points off for each miss.

The title screen reads “3K REVIEW OF SOLAR SYSTEM”. Solar System Review was submitted by Joan Kealy to the ZXir QLive Alive! newsletter, and this copy is from the newsletter’s Issue 2 disk. A companion program on the disk prints her preface, which is included in the download as a text file. In it she explains that she put astronomy questions and answers into a question-and-answer template from a teachers’ computing magazine, and invites readers to replace the DATA lines with any subject they want to learn. The preface names the magazine as both “Computers and Teachers” and “Computers and Teaching”.

Program Analysis

Structure

Line 6 turns on caps lock with POKE 23658,8 and calls the instructions at line 8000. Line 8 dimensions A$(25,100) for questions, B$(25,31) for answers and Y(25) to mark questions already answered correctly, and line 20 reads 25 question-and-answer pairs from the DATA at lines 3005–3135. The main loop at lines 30–76 runs 25 times. Each time it picks a random question, rejecting any whose number is already in Y(), prints it and takes an answer with INPUT. Lines 80–90 print the misses, the grade 100-SC*4 and a note that a retake usually improves the score.

Answer checking

Line 70 pads the reply with spaces and cuts it to 31 characters so that it can be compared directly with the fixed-length B$() entry. The match must be exact, including commas in numbers such as 7,900 and 186,000 and words such as MPH and DEGREES.

Notable Techniques

  • Numeric constants are written as VAL "25", SGN PI and NOT PI to save memory, as is common in Sinclair BASIC.
  • Only correctly answered questions are recorded in Y(). A missed question can come up again later in the same run, so the quiz drills the questions you get wrong.
  • The questions are plain DATA pairs, which is what lets a user swap in another subject as the preface suggests.

Potential Issues

  • There are 27 question-and-answer pairs in the DATA, but line 20 reads only 25, so the last two questions (lines 3130 and 3135) are never asked.
  • Line 8005 calls the “PRESS ANY KEY” routine at line 9996 with GO SUB, then falls through into line 9996 again before returning, so the opening screen needs two key presses.
  • Line 74 prints "SORRY!";B$(X) with no space, so the correct answer runs into the word SORRY!.
  • Some answers are dated or wrong: the Egyptian astronomer is given as Julius Ptolemy rather than Claudius Ptolemy, and the question on Mercury’s “dark side” assumes that Mercury always keeps one face to the Sun, which was disproved in 1965.

This copy came from a Larken disk. For tape, the RANDOMIZE USR 100 disk call was removed from the save line, the autostart was set to line 1, and the disk’s variables marker was dropped. It was tested in ZEsarUX.

Related Articles

Modified from the magazine Computers and Teachers.

Image Gallery

Source Code

    1 PRINT ''"   3K REVIEW OF SOLAR SYSTEM   "
    2 RESTORE 3000
    5 LET SC=0
    6 POKE VAL "23658",VAL "8": GO SUB VAL "8000": CLS 
    8 DIM A$(VAL "25",VAL "100"): DIM B$(VAL "25",VAL "31"): DIM Y(VAL "25")
   20 FOR I=SGN PI TO VAL "25": READ A$(I),B$(I): NEXT I
   30 FOR J=SGN PI TO VAL "25"
   35 LET X=INT (RND*VAL "25")+SGN PI
   40 FOR Z=SGN PI TO VAL "25"
   50 IF X=Y(Z) THEN GO TO VAL "35"
   55 NEXT Z
   60 PRINT : PRINT A$(X)
   68 LET D$="                                "
   70 INPUT C$: LET C$=C$+D$: LET C$=C$(SGN PI TO VAL "31")
   72 IF C$=B$(X) THEN PRINT ; PAPER VAL "5";"YOU'RE RIGHT!": LET Y(X)=X: PAUSE VAL "180": GO TO VAL "76"
   74 PRINT INK VAL "9"; PAPER VAL "3";"SORRY!";B$(X): LET SC=SC+SGN PI: PAUSE VAL "180"
   76 NEXT J
   78 CLS 
   80 PRINT PAPER VAL "6";"OUT OF 25 QUESTIONS, YOU MISSED ";SC;''"YOUR GRADE IS ";VAL "100"-(SC*VAL "4")
   90 PRINT '"IF YOU ARE DISAPPOINTED WITH    YOUR GRADE, A RETAKE WILL RESULTIN ABOUT 15 POINT GROWTH."
  100 STOP 
 3000 REM QUESTIONS ON SOLAR SYSTEM
 3005 DATA "GREATEST EGYPTIAN ASTRONOMER?","JULIUS PTOLEMY"
 3010 DATA "TERM FOR PTOLEMY'S MODEL OF UNI-VERSE?","GEOCENTRIC"
 3015 DATA "AFTER 1400 YRS. POLISH MONK WHO REJECTED GEOCENTRIC MODEL?","NICHOLAS COPERNICUS"
 3020 DATA "WHO FORMULATED 3 LAWS FOR MOTIONOF PLANETS?","JOHANNES KEPLER"
 3025 DATA "ITALIAN WHO RECANTED HIS HELIO- CENTRIC THEORY UNDER RELIGIOUS  PRESSURE?","GALILEO GALILEI"
 3030 DATA "FORMAL NAME OF THE NORTH STAR?","POLARIS"
 3035 DATA "BECAUSE OF PRECESSION IN 12,000 YRS. THE NORTH STAR WILL BE?","VEGA"
 3040 DATA "THE EQUATORIAL EQUATOR IS 7,927 MILES BUT THE POLAR EQUATOR IS?","7,900" 
 3045 DATA "EARTH'S ROTATION IS EASTWARD OR RE A CLOCK?","COUNTERCLOCKWISE"
 3050 DATA "DUE TO ROTATION PREVALING WINDS IN U.S. ARE FROM?","SOUTHWEST"
 3055 DATA "APPARENT PATH OF SUN'S 1 YR.    TRIP THRU THE STARS IS CALLED?","ECLIPTIC"
 3060 DATA "NEAREST STAR TO EARTH?","PROXIMA"
 3065 DATA "PROXIMA'S DISTANCE IN LIGHT YRS.?","OVER 4"
 3070 DATA "TERM FOR ONE BODY TRAVELING IN  ORBIT AROUND ANOTHER?","REVOLUTION"
 3075 DATA "TERM USED WHEN BODY TURNING ON  INTERNAL AXIS?","ROTATION"
 3080 DATA "EARTH IS FARTHER FROM SUN IN    JULY THAN JAN. BY MILES?","3 MILLION"
 3085 DATA "EARTH'S EQUATOR EXTENDED OUT TO STARS?","CELESTIAL EQUATOR"
 3090 DATA "TILT OF EARTH'S AXIS FROM PERPENDICULAR?","23.5 DEGREES"
 3095 DATA "OUR SOLAR SYSTEM IS MOVING THRU MILKY WAY AT 12 MPS OR MPH?","43,200 MPH"
 3100 DATA "LIGHT TRAVELS IN MILES PER SEC.?","186,000"
 3105 DATA "TWO PLANETS CLOSER TO SUN THAN  EARTH?","MERCURY AND VENUS"
 3110 DATA "DARK SIDE OF MERCURY IS ALWAYS  WITHIN FEW DEGREES OF PERFECT 0 OR ABOUT?","-440 DEGREES"
 3115 DATA "ONE ASTRONOMICAL UNIT (A.U.)=?","93 MILLION MILES"
 3120 DATA "ONE A.U. IS BASED ON THE MEAN   DISTANCE OF EARTH FROM?","THE SUN"
 3125 DATA "KEPLER'S 3RD LAW RELATING SIZE  OF ORBIT TO TIME OF REVOLUTION  IS CALLED?","HARMONIC LAW"
 3130 DATA "ABOUT 99.8% OF SOLAR SYSTEM'S   MASS IS CONCENTRATED IN ?","THE SUN"
 3135 DATA "ABOUT HALF OF .2% OF MASS OF OUR SOLAR SYSTEM IS CONCENTRATED IN WHICH PLANET?","JUPITER" 
 8000 PRINT ''"NOTE THAT FIRST AND LAST NAMES  ARE EXPECTED FOR ANSWERS, NO    INITIALS",''"OF COURSE, COMPUTERS ARE VERY   ARBITARY"  
 8005 GO SUB VAL "9996"
 9996 PRINT AT VAL "21",VAL "7";"PRESS ANY KEY": PAUSE NOT PI: RETURN 
 9997 STOP 
 9998 CLEAR : RANDOMIZE USR 100: SAVE "SOLARS.B1" LINE SGN PI

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