User Tools

Site Tools


en:safecrack

SAFECRACKER

Info

Author Philips T Lawson
Computer Amstrad PCW 8256 / 8512 / 9512
Year 1987
Gender Puzzle
Controls Keyboard
Languages English
State Preserved

Screenshots

Description

SAFECRACKER is a variation of the classic Mastermind game where you were trying to find a hidden pattern of colors. Here, your goal is to discover the combination to the Natlands vault which, like most safes, would normally only give you three tries to get the correct code.

Fortunately, a bank employee (who you're blackmailing) managed to mess with the programming of the computerized lock, so now you get 20 attempts with a progress report after each one. As an added help, his inner man also managed to figure out the format of the code, which briefly looks like this:

The code has five segments, each of which consists of two symbols. The first symbol must be L or R and the second a number in the range 0 to 9. For example, L1R3L6L2RO.

A progress report is provided in simple terms: white means a segment has been successfully identified; black means that one segment contains the symbols belonging to another. Be careful though, this can be quite misleading at higher levels, as the code may contain multiple segments with identical symbols.

There are three difficulty levels ranging from level 1 (easiest), with no duplicate symbols in 20 moves, to level 3, possible duplicate symbols also within 20 moves, and a time limit of five minutes.

When you run the program, you will be prompted to enter a level. The screen will then display the safe along with a combination panel reflecting your entry into the electronic drum mechanism. Use the keyboard for all input and to turn the sound on and off, press S. If you make a mistake, use C to cancel it. When you have decided what code to enter and display it on the panel, press Enter or Return.

It only remains to wish him luck and keep an eye on the security guard.

List

  • Listing - SAFECRAC.BAS
10 REM         Safecracker
20 REM     By Philip T Lawson
30 REM (c) Computing With The Amstrad 
40 REM ------------ PCW ------------- 
50 DEF FNat$(x,y,a$)=CHR$(27)+"Y"+CHR$(32+y)+CHR$(32+x)+a$
60 DEFINT a-z:cl$=CHR$(27)+"E"+CHR$(27)+"H"
70 WHILE lev<1 OR lev>3:PRINT cl$
80 PRINT"Enter level.   1 - Easy"
90 PRINT,"2 - Difficult"
100 PRINT,"3 - Time limit";
110 INPUT lev
120 RANDOMIZE PEEK(64504!)
130 WEND:PRINT cl$;CHR$(27)+"f"
140 DIM x(12),y(12),a$(12),at$(20),w(20),b(20)
150 RESTORE 170:FOR a=0 TO 12:READ x(a),y(a),a$(a):NEXT
160 FOR a=0 TO 12:GOSUB 710:NEXT:GOSUB 740
170 DATA 75,20,0,71,17,1,75,17,2,79 
180 DATA 17,3,71,14,4,75,14,5,79,14 
190 DATA 6,71,11,7,75,11,8,79,11,9 
200 DATA 71,20,L,79,20,R,79,23,C
210 PRINT CHR$(27)+"p"
220 PRINT FNat$(40,5,CHR$(134)+STRING$(20,CHR$(138))+CHR$(140))
230 PRINT FNat$(40,20,CHR$(131)+STRING$(20,CHR$(138))+CHR$(137))
240 FOR a=6 TO 19:PRINT FNat$(40,a,CHR$(133)):PRINT FNat$(61,a,CHR$(133)):NEXT 
250 FOR a=6 TO 19:PRINT FNat$(41,a,STRING$(20," ")):NEXT
260 PRINT FNat$(48,10,"T H E"):PRINT FNat$(47,13,"S A F E")
270 c$="":FOR a=1 TO 5:t=INT(RND*100):IF t<50 THEN c$=c$+"R" ELSE c$=c$+"L"
280 c$=c$+RIGHT$(STR$(INT(RND*10)),1):IF a=1 OR lev>1 THEN 310
290 temp=0:FOR b=1 TO a-1:IF MID$(c$,(b*2)-1,2)=RIGHT$(c$,2) THEN temp=1
300 NEXT:IF temp=1 THEN a=a-1:c$=MID$(c$,1,a*2)
310 NEXT:PRINT CHR$(27)+"q"
320 PRINT FNat$(1,1,"Try   Code    White  Black")
330 try=1:POKE 64504!,0:POKE 64503!,0
340 REM ********************************************************
350 win=0:lose=0:WHILE win=0 AND lose=0 
360 i$="":WHILE i$="" AND i$<>CHR$(13):i$=INKEY$:WEND:i$=UPPER$(i$)
370 IF i$="S" THEN IF sou=1 THEN sou=0 ELSE sou=1
380 IF i$=CHR$(13) THEN GOSUB 840:GOTO 480
390 IF i$=" " OR ASC(i$)=7 OR i$<"0" THEN 360
400 IF i$>"9" AND i$<>"L" AND i$<>"R" AND i$<>"C" THEN 360
410 IF lev=3 AND PEEK(64503!)>4 THEN lose=1
420 a=VAL(i$):IF i$="L" THEN a=10 ELSE IF i$="R" THEN a=11 ELSE IF i$="C" THEN a=12
430 IF a<>12 AND LEN(yc$)=10 THEN 480 
440 PRINT CHR$(27)+"p":GOSUB 710
450 IF sou=0 THEN PRINT CHR$(7)
460 PRINT CHR$(27)+"q":GOSUB 710
470 IF i$="C" THEN GOSUB 680 ELSE GOSUB 660
480 WEND
490 IF lose THEN 560
500 GOSUB 630
510 PRINT FNat$(42,7,"The safe contains")
520 PRINT FNat$(43,10,"piles of lovely") 
530 PRINT FNat$(47,13,"M O N E Y")
540 PRINT FNat$(20,24,"Press spacebar to play again")
550 WHILE INKEY$<>"":WEND:RUN
560 GOSUB 630
570 IF lose=2 THEN 600
580 PRINT FNat$(47,12,"T I M E")
590 PRINT FNat$(49,14,"U P"):GOTO 540 
600 PRINT FNat$(47,7,"H A R D")
610 PRINT FNat$(47,10,"L U C K")
620 GOTO 540
630 FOR a=14 TO 1 STEP-1:FOR b=1 TO 100:NEXT
640 PRINT FNat$(41,a+5,STRING$(20," ")):NEXT
650 RETURN
660 IF LEN(yc$)=10 THEN RETURN
670 yc$=yc$+i$:PRINT FNat$(82-LEN(yc$),8,yc$):RETURN
680 IF yc$="" THEN RETURN
690 PRINT FNat$(82-LEN(yc$),8," ");:yc$=LEFT$(yc$,LEN(yc$)-1)
700 PRINT FNat$(82-LEN(yc$),8,yc$):RETURN
710 PRINT FNat$(x(a),y(a),CHR$(134)+CHR$(138)+CHR$(140))
720 PRINT FNat$(x(a),y(a)+1,CHR$(133)+a$(a)+CHR$(133))
730 PRINT FNat$(x(a),y(a)+2,CHR$(131)+CHR$(138)+CHR$(137)):RETURN
740 PRINT FNat$(71,23,CHR$(134)+STRING$(5,CHR$(138))+CHR$(140))
750 PRINT FNat$(71,24,CHR$(133)+"ENTER"+CHR$(133))
760 PRINT FNat$(71,25,CHR$(131)+STRING$(5,CHR$(138))+CHR$(137))
770 PRINT FNat$(70,7,CHR$(134)+STRING$(11,CHR$(138))+CHR$(140))
780 PRINT FNat$(70,8,CHR$(133)+"           "+CHR$(133))
790 PRINT FNat$(70,9,CHR$(131)+STRING$(11,CHR$(138))+CHR$(137))
800 PRINT FNat$(68,5,CHR$(150)+STRING$(15,CHR$(154))+CHR$(156))
810 PRINT FNat$(68,27,CHR$(147)+STRING$(15,CHR$(154))+CHR$(153))
820 FOR a=6 TO 26:PRINT FNat$(68,a,CHR$(149)):PRINT FNat$(84,a,CHR$(149)):NEXT 
830 RETURN
840 IF LEN(yc$)=10 THEN 870
850 PRINT FNat$(72,8,"  ERROR  "):yc$=""
860 FOR i=1 TO 300:NEXT:PRINT FNat$(74,8,"     "):RETURN
870 temp=0:FOR a=1 TO 5:t$=MID$(yc$,a*2-1,2)
880 IF LEFT$(t$,1)<>"L" AND LEFT$(t$,1)<>"R" THEN temp=1
890 IF RIGHT$(t$,1)>"9" THEN temp=1 
900 NEXT:IF temp=1 THEN 850
910 IF yc$=c$ THEN win=1
920 at$(try)=yc$
930 wh=0:FOR a=1 TO 5
940 IF MID$(c$,a*2-1,2)=MID$(yc$,a*2-1,2) THEN wh=wh+1:MID$(yc$,a*2-1,2)=" "
950 NEXT:bl=0:FOR a=1 TO 5:FOR b=1 TO 5 
960 IF MID$(c$,a*2-1,2)=MID$(yc$,b*2-1,2) THEN bl=bl+1
970 NEXT:NEXT:w(try)=wh:b(try)=bl
980 PRINT FNat$(0,try+2,STR$(try)+") "+at$(try)+"  ");
990 PRINT wh;"   ";bl
1000 try=try+1:IF try>20 THEN lose=2 
1010 yc$="":PRINT FNat$(72,8,"         "):RETURN
1020 END
1030 FOR a=128 TO 160:PRINT CHR$(a),a:NEXT
1040 a$="":WHILE a$="":a$=INKEY$:WEND:PRINT ASC(a$):GOTO 1040

Controls

              L = LEFT
              R = RIGHT
              C = DELETE
              S = SOUND ON/OFF
   ENTER/RETURN = ACCEPT
      

Loading the program

1.- Insert the CP/M disc on side 2
2.- Write BASIC and wait for it to load
3.- Remove the CP/M disk and insert the disk containing the Safecracker game
4.- Type run "SAFECRAC" and press the "ENTER" key

Extras

  • Listing of the program in a large-circulation magazine of the time

safecrack_01.jpg safecrack_02.jpg

Download

en/safecrack.txt · Last modified: 2022/06/29 00:41 by jevicac