SAFECRACKER

Are you a quick-thinker or a deep thinker? I hope you are one or the other, or you will never be able to crack open someone elses's safe!

This game can be played two different ways, depending on whether you are a quick or deep thinker. If you are not sure which you are, then I suggest you play it both ways, and find out which way gives you the highest score.

In all cases, a closed safe is displayed and you are given two clues about the secret code that opens it. If you work out the exact answer before keying in the code, you are given 2 minutes to do it. If you make guesses, then you are only allowed 16 seconds. Wrong answers are ignored.

If you take too long you are surprised by the caretaker who switches on the light. He then presses the alarm button and you hear the police sirens wailing and you know all is lost!

If you do manage to crack the code in time, the safe opens, revealing gold bullion.

How to play

You are given two clues such as those shown above. The code is always two digits. Key in the number (you do not need to press RETURN).

To end the program, press E.

Programming hints

This program contains two useful procedures. PROC BLOCK draws a rectangle whose lower left hand corner is X,Y and whose width is W and height is H. PROC_PARLL draws a parallelogram with two sides vertical. Put the coordinates of the lower, left-hand corner in X1, Y1 and those of the upper right hand corner X2, Y2.

If you want to make the game easier, you can increase the time allowed to guess or reduce the number of digits allowed in the code or both.

To increase the time allowed for guesses, increase the value of TM in line 230. To increase the time allowed when only one answer is keyed in, increase the value of TM in line 210.

To the reduce the number of digits allowed, reduce the number inside the RND brackets for XX and YY in line 510.

If you find the game too easy then do the opposite.

   10 REM SAFE CRACKER
   20 REM COPYRIGHT (C) G.LUDINSKI 1983
   30 MODE5:VDU23;8202;0;0;0;19,1,0;0;19
,3,0;0;
   40 BL=0:RD=1:YE=2:WH=3:B=128
   50 SC=0
   60 TIME=0
   70 COLOUR BL+B:COLOUR WH
   80 CLS
   90 PRINTTAB(0,1)"Score":PRINT"  ";SC
  100 REM
  110 REM DRAW SAFE CLOSED
  120 REM
  130 GCOL 0,RD:PROC_BLOCK(0,0,1280,400)
  140 GCOL 0,WH:PROC_BLOCK(400,350,400,6
00)
  150 GCOL 0,BL:MOVE450,400:DRAW750,400:
DRAW750,900:DRAW450,900:DRAW450,400
  160 COLOUR BL:COLOUR B+WH:PRINTTAB(10,
12)"*"
  170 PROC_QUESTION
  180 COLOUR RD+B:COLOUR WH:PRINTTAB(0,2
2)"If you multiply the 1st digit by ";A1
;" and  the 2nd digit by ";ABS(B1);"  an
d ";S1$;"   the result is ";C1;"."
  190 PRINT"The 1st digit ";S2$
  200 PRINT"the 2nd digit is ";C2:PRINT"
What is the code":VDU19,1,1;0;19,2,3;0;1
9,3,7;0;
  210 TM=6000
  220 I1$=INKEY$(0):IF TIME < TM AND I1$
="" THEN GOTO 220
  230 IF I1$<>LEFT$(A$,1) AND I1$<>"E" A
ND TIME < TM THEN TM=800:GOTO220
  240 IF I1$="E" THEN GOTO700
  250 IF TIME >= TM THEN GOTO380
  260 PRINT I1$;
  270 I2$=INKEY$(0):IF TIME < TM AND I2$
="" THEN GOTO270
  280 IF I2$<>RIGHT$(A$,1)AND TIME < TM 
THEN GOTO270
  290 IF TIME >= TM THEN GOTO 380
  300 PRINT'I2$;
  310 I$=I1$+I2$
  320 IF I$=A$ THEN SC=SC+1:PROC_OPEN
  330 PRINT" No, the code is ";A$
  340 GOTO 60
  350 REM
  360 REM SWITCH LIGHT ON AND PLAY POLIC
E SIREN SOUNDS
  370 REM
  380 PRINT" No, the code is ";A$:VDU19,
BL,3,0,0,0:FORI=1TO6:SOUND1,-15,109,8:SO
UND1,-15,101,8:NEXT:RB$=INKEY$(1000):VDU
19,BL,0,0,0,0:VDU19,1,0;0;19,2,0;0;19,3,
0;0;:GOTO60
  390 REM
  400 DEFPROC_BLOCK(X,Y,W,H)
  410 MOVE X,Y:MOVE X+W,Y
  420 PLOT 85,X,Y+H
  430 PLOT 85,X+W,Y+H
  440 ENDPROC
  450 DEFPROC_PARLL(X,Y,X1,Y1,X2,Y2)
  460 MOVE X,Y
  470 MOVE X1,Y1:PLOT 85,X,Y+Y2-Y1
  480 PLOT 85,X2,Y2
  490 ENDPROC
  500 DEFPROC_QUESTION
  510 A1=RND(8)+1:B1=RND(8)+1:XX=RND(10)
-1:YY=RND(10)-1
  520 W1=(-1)^RND(2):W2=(-1)^RND(2)
  530 B1=B1*W1
  540 C1=(A1*XX)+(B1*YY)
  550 C2=XX+(W2*YY)
  560 S1$="add them then":IF W1=-1 THEN 
S1$="subtract them"
  570 S2$="plus":IF W2=-1 THEN S2$="minu
s"
  580 A$=STR$(ABS(XX))+STR$(ABS(YY))
  590 ENDPROC
  600 REM
  610 REM DRAW SAFE OPEN
  620 REM
  630 DEFPROC_OPEN
  640 GCOL 0,WH:PROC_PARLL(300,350,450,4
00,450,900)
  650 GCOL 0,BL:PROC_BLOCK(450,400,300,5
00)
  660 GCOL 0,YE:PROC_BLOCK(450,400,300,2
00)
  670 GCOL 0,BL:MOVE300,330:DRAW450,400:
DRAW450,900:DRAW300,830
  680 COLOUR B+BL:PRINTTAB(2,2);SC:RB$=I
NKEY$(1000):VDU19,1,0;0;19,2,0;0;19,3,0;
0;
  690 ENDPROC