FRACTION CAR CHASE


We might have named this program 'Duel' after the film of the same name as, like the hero of the film, you are being chased by a juggernaut driver.

As you turn right, the juggernaut turns right; turn left and it still follows you.

Coming up in the near distance is an archway. You must escape through the arch before the lumbering truck rolls over you.

Your only answer is to work out how far across the road the centre of the arch is. Guess wrongly and you hit the arch damaging your. Too many wrong guesses and your car will be immobilised leaving you the defenceless victim of the fast approaching juggernaut.

How to play

The computer will think of a number whose numerator (top half) and denominator (bottom half) are both ten or less. You must guess the correct fraction and enter it in using the / symbol (eg 2/3) and RETURN. If your guess is too big, or small, you will be told. The guess closest to the correct answer, will be displayed on the arch. The lower guess will be shown on the left hand pillar and the higher guess, closest to the correct answer, will be shown on the right hand pillar.

If your answer is displayed on the arch then you know that you are almost correct. You have nine lives.

This is more difficult than it sounds, after all do you know which is the larger, 3/8 or 4/9? You will be amazed at what you find out about fractions. A hint is that to make a fraction bigger, increase its numerator (top half) or reduce its denominator (bottom half) or both. Do the opposite to make a fraction smaller.

Programming hints

To make the game easier, reduce the range of fractions allowed. This is done by reducing the tens in line 230. To make it more difficult you may increase these numbers to maximum values of 99 each.

If you want to allow more guesses, increase the 9 in line 280.


   10 REM FRACTION CAR CHASE
   20 REM COPYRIGHT (C) G.LUDINSKI 1983
   30 MODE 5
   40 VDU 19,0,4,0,0,0
   50 CLS
   60 GOTO 130
   70 DEF FNB(N$)
   80 TF=0
   90 FOR L=0 TO 7
  100 TF=TF+(2^L)*VAL(MID$(N$,8-L,1))
  110 NEXT L
  120 =TF
  130 VDU 23,224,FNB("01111110"),FNB("01
000010"),FNB("01000010"),255,255,255,255
,FNB("01000010")
  140 COLOUR128:CLS:MAX=1:MIN=0:CA$=CHR$
(128):M1$="0":M2$=" ":X1$="1":X2$=" "
  150 REM
  160 REM DRAW ARCH
  170 REM
  180 GCOL 0,3:PROC_BLOCK(0,0,1280,350)
  190 GCOL 0,2:PROC_BLOCK(190,290,210,51
0):PROC_BLOCK(800,290,220,510):PROC_BLOC
K(190,600,830,200)
  200 REM
  210 REM THINK OF FRACTION
  220 REM
  230 F=RND(10):G=RND(10)
  240 PROC_REDUCE
  250 IF F=G OR F/G=INT(F/G) OR G/F=INT(
G/F) THEN 230
  260 IF G<F THEN H=G:G=F:F=H
  270 COLOUR131:COLOUR1:PRINTTAB(9,23)CA
$
  280 FORT=1TO9
  290   COLOUR131:COLOUR0:PRINTTAB(0,24)
STRING$(120," ");
  300   PRINTTAB(0,24)"Guess the fractio
n.        Use /"
  310   INPUTI$:IF I$="" THEN 310
  320 REM
  330 REM CHECK ENTRY
  340 REM
  350   FORI=1TOLEN(I$)
  360     C$=MID$(I$,I,1)
  370     IF(C$<"0" OR C$>"9") AND C$<>"
/" THEN GOTO 400
  380     IF C$="/" AND I>1 AND LEN(I$)>
2 THEN NM$=LEFT$(I$,I-1):DN$=RIGHT$(I$,L
EN(I$)-I):GOTO410
  390   NEXTI
  400   VDU11:SOUND1,-15,50,10:GOTO310
  410   IFLEN(NM$)>2 OR LEN(DN$)>2 THEN 
GOTO 400
  420 REM
  430 REM DISPLAY FRACTION BETWEEN ARCH
  440 REM
  450   COLOUR128:COLOUR3:PRINTTAB(9,16)
;"  ":PRINT TAB(9,16);NM$:PRINT TAB(8,17
);"___":PRINT TAB(9,19);"  ":PRINT TAB(9
,19);DN$
  460   COLOUR128:COLOUR3:PRINTTAB(6,2)"
Guess ";T
  470   IF NM$=STR$(F) AND DN$=STR$(6) T
HEN PRINT'"    That's right":PROC_CAR(" 
",CA$," "):GOTO600
  480   IF NM$="0" OR DN$="0" THEN 400
  490   VI=EVAL(I$)
  500   COLOUR131:PRINTTAB(9,23)" ":COLO
UR128
  510   IF VI < F/G THEN PRINTTAB(6,4)"T
oo small":PROC_CAR(CA$," "," ")
  520   IF VI > F/G THEN PRINTTAB(6,4)"T
oo big  ":PROC_CAR(" "," ",CA$)
  530   IF VI < MAX AND VI > F/G THEN MA
X=VI:X1$=NM$:X2$=DN$
  540   IF VI MIN AND VI < F/G THEN MIN=
VI:M1$=NM$:M2$=DN$
  550   COLOUR0:COLOUR130:PRINTTAB(4,16)
"  "TAB(4,16)M1$
  560   IF M2$<>" " THEN PRINTTAB(3,17)"
___"TAB(4,19)"  "TAB(4,19)M2$
  570   PRINTTAB(14,16)"  "TAB(14,16)X1$
  580   IF X2$<>" " THEN PRINTTAB(13,17)
"___"TAB(14,19)"  "TAB(14,19)X2$
  590   GOTO610
  600   COLOUR0:COLOUR131:PRINTTAB(0,24)
;STRING$(120," "):PRINTTAB(0,24)"You esc
aped - Phew!":GOTO700
  610   COLOUR131:PRINTTAB(0,28)"Another
 guess (Y/N) ";
  620 INPUT R$
  630 IF R$_"N" THEN GOTO 710
  640 NEXTT
  650 REM
  660 REM END OF GUESSES
  670 REM
  680 COLOUR0:COLOUR131:PRINTTAB(0,24);S
TRING$(120," "):PRINTTAB(0,24)"The jugge
rnaut      closes in"
  690 PRINT'"The fraction is     ";F;"/"
;G
  700 OSCLI("FX 21"):PRINT'"More (Y/N)";
  710 INPUT R$:IF R$ <> "N" THEN GOTO 14
0
  720 GOTO 850
  730 STOP
  740 DEFPROC_BLOCK(X,Y,W,H)
  750 MOVEX,Y:MOVEX+W,Y
  760 PLOT 85,X,Y+H
  770 PLOT 85,X+W,Y+H
  780 ENDPROC
  790 DEFPROC_CAR(P1$,P2$,P3$)
  800 COLOUR130:COLOUR1:PRINTTAB(4,22)P1
$;TAB(14,22)P3$;:COLOUR131:PRINTTAB(9,22
)P2$
  810 ENDPROC
  820 DEFPROC_REDUCE
  830 FORI=2TO9
  840   IF F/I = INT(F/I) AND G/I = INT(
G/I) THEN F=F/I:G=G/I:GOTO820
  850 NEXTI
  860 ENDPROC
  870 END