10 REM ** Hide the Rat **
20 REM ** a game for the Amstrad CPC 464 **
30 REM **   Steve Lucas    July 1984 **
40 RANDOMIZE TIME: REM set random number generator to random start
50 s%=6: REM alter this number to suit number of lives you want !
60 BORDER 8
70 MODE 1
80 GOSUB 1130 : REM title
90 REM ** define characters **
100 SYMBOL AFTER 238
110 SYMBOL 239,255,255,255,255,255,255,255,255
120 SYMBOL 240,192,128,156,191,255,255,65,113
130 SYMBOL 241,0,96,112,88,204,252,0,192
140 SYMBOL 242,48,32,32,32,32,32,31,15
150 SYMBOL 243,1,3,7,7,3,1,255,255
160 SYMBOL 244,0,128,192,240,176,240,248,136
170 SYMBOL 245,7,3,1,1,0,1,1,0
180 SYMBOL 246,255,255,253,129,128,129,193,0
190 SYMBOL 247,134,128,128,128,128,128,192,0
200 SYMBOL 248,7,4,13,12,4,6,1,1
210 SYMBOL 249,240,16,88,152,16,48,192,192
220 SYMBOL 250,0,3,6,12,9,9,9,9
230 SYMBOL 251,128,224,176,216,72,72,72,72
240 SYMBOL 252,29,21,21,3,3,3,6,4
250 SYMBOL 253,92,212,212,224,224,224,48,16
260 SYMBOL 254,4,6,4,28,28,0,0,0
270 SYMBOL 255,16,48,16,28,28,0,0,0
280 aa$=CHR$(242)+CHR$(243)+CHR$(244)+CHR$(10)+CHR$(8)+CHR$(8)+CHR$(8)+CHR$(245)+CHR$(246)+CHR$(247)
290 ab$=CHR$(240)+CHR$(241)
300 ac$=CHR$(248)+CHR$(249)+CHR$(10)+CHR$(8)+CHR$(8)+CHR$(250)+CHR$(251)+CHR$(10)+CHR$(8)+CHR$(8)+CHR$(252)+CHR$(253)+CHR$(10)+CHR$(8)+CHR$(8)+CHR$(254)+CHR$(255)
310 REM ** select colours **
320 INK 0,24:INK 1,20:INK 2,6:INK 3,2
330 PEN 1
340 REM ** draw board **
350 t%=4:d$=STRING$(3,CHR$(143))
360 e$=STRING$(3,CHR$(32))+d$
370 f$=d$+STRING$(3,CHR$(32))
380 g$=e$+e$+e$+e$+e$
390 h$=f$+f$+f$+f$+f$
400 FOR t=1 TO 4
410 FOR x=1 TO 3:PRINT g$:NEXT
420 FOR x=1 TO 3:PRINT h$:NEXT
430 NEXT
440 MOVE 0,18:DRAW 480,18,3
450 DRAW 480,400,3
460 LOCATE 1,25: PEN 2:PRINT" A  B  C  D  E  F  G  H  I  J"
470 MOVE 515,400: DRAW 515,0,3
480 FOR y=1 TO 8: LOCATE 32,Y*3-1:PRINT CHR$(48+Y): NEXT : LOCATE 1,1
490 REM ** hide rat somewher on the board **
500 a%=INT(RND(1)*10)+1:b%=INT(RND(1)*8)+1
510 REM ** main control loop **
520 WHILE s%>0
530 GOSUB 690
540 s%=s%-1
550 t%=s%-1
560 WEND
570 CLS #2: PRINT#2,"You    didn't find it"
580 a$="abcdefghij"
590 b$=MID$(a$,a%,1)
600 PEN #2,3
610 PRINT#2,"It was in "
620 IF a%=1 OR a%=3 OR a%=5 OR a%=7 OR a%=9 THEN GOSUB 1390 ELSE GOSUB 1410
630 PEN #2,2:PRINT#2,b$;b%
640 LOCATE a%*3-2,b%*3-1:PEN 3:PRINT aa$
650 PRINT #2:PRINT#2:PRINT#2
660 PRINT#2,"Press  Space  Bar."
670 a$=INKEY$: IF a$<>" " THEN 670
680 RUN
690 WINDOW #1,34,40,18,25
700 WINDOW #2,34,40,1,16: PEN #1,2
710 PEN #1,3: PAPER #1,1: CLS #1:PRINT#1," Enter  guess  now"
720 a$=INKEY$:IF a$="" THEN 720
730 a$=UPPER$(a$):LOCATE 36,22:PRINT a$+" "
740 c%=ASC(a$)
750 IF c%<65 OR c%>74 THEN 720
760 c%=c%-64
770 a$=INKEY$:IF a$="" THEN 770
780 d%=ASC(a$)-48:IF d%>8 OR d%<1 THEN 770
790 LOCATE 38,22: PRINT d%
800 IF  c%=1 OR c%= 5 OR c%=3 OR c%=9 OR c%=7 THEN GOSUB 1350 ELSE GOSUB 1370
810 LOCATE c%*3-1,d%*3-1:PEN 2: PRINT ab$: LOCATE 4,10 :PRINT CHR$(7)
820 b$=""
830 IF a%=c% AND d%=b% THEN 940
840 IF d%>b% THEN GOSUB 890 ELSE GOSUB 910
850 CLS #2: PRINT#2,"Lives:-"; s%-1
860 PRINT#2:PRINT#2,aa$:PRINT#2:PRINT#2
870 PEN #2,2: PRINT#2,"  Go": PRINT #2:PRINT #2: PEN #2,3: PRINT #2,"  ";b$
880 RETURN
890 b$="N": IF c%<a% THEN b$=b$+"E" ELSE IF c%>a% THEN b$=b$+"W"
900 RETURN
910 IF b%>d% THEN b$="S"
920 IF a%>c% THEN b$=b$+"E" ELSE IF c%>a% THEN b$=b$+"W"
930 RETURN
940 CLS
950 LOCATE 1,4:PEN 2: PRINT ac$
960 LOCATE 20,4:PRINT ac$
970 LOCATE 4,22:PEN 3:PRINT ac$
980 LOCATE 20,22:PRINT ac$
990 LOCATE 2,10:PEN 2:PRINT"Well Done. You have found the rat !"
1000 RESTORE
1010 FOR x= 1 TO 34
1020 READ d: SOUND 5,d,20,15
1030 FOR t=1 TO 10: NEXT t
1040 NEXT x
1050 LOCATE 2,15: PEN 3: PRINT"Would you like another game <Y/N> ?"
1060 a$=INKEY$:IF a$="" THEN 1060
1070 a$=LOWER$(a$)
1080 IF a$="y" THEN RUN
1090 IF a$<>"n" THEN 1060
1100 CLS: LOCATE 5,15: PRINT"Goodbye..Thank you for playing !"
1110 END
1120 DATA 239,239,213,239,190,239,239,213,190,179,159,239,239,213,190,179,159,239,239,213,239,159,239,142,239,127,239,127,142,159,179,190,213,239
1130 BORDER 15:INK 0,0:INK 1,24:INK 2,6: INK 3,26
1140 PAPER 0
1150 CLS:PEN 1: LOCATE 12,5:PRINT "Catch The Rat"
1160 PRINT:PRINT:PRINT:PEN 2:PRINT"A game of skill for the Amstrad CPC 464"
1170 PRINT:PRINT:PRINT:PEN 3: PRINT"    by   Steve W. Lucas    July 1984"
1180 PRINT:PRINT:PRINT:PEN 1: PRINT"A rat has escaped and you have been sentto track it down !"
1190 PRINT"It is hiding somewhere on the 10x8 boardwhich is displayed on the screen. You   have only five turns in which to try to locate it."
1200 RESTORE
1210 FOR x= 1 TO 34
1220 READ d: SOUND 5,d,20,15
1230 FOR t=1 TO 10: NEXT t
1240 NEXT x
1250 PEN 2:PRINT:PRINT"Press the   <Space Bar>  to continue."
1260 a$=INKEY$: IF a$<>" " THEN 1260
1270 CLS:PEN 3
1280 PRINT"The board is labelled and you must send in tracker cats to see if it is hiding  there. After each attempt you will be   told a compass direction which you will need to go in for your next turn !"
1290 PRINT:PRINT:PRINT:PEN 1:PRINT"The coordinates of the square you want  to search must be entered in the form   letter number  (eg. E4)."
1300 LOCATE 2,24:PEN 2: PRINT"Press   <Space Bar> to start game."
1310 a$=INKEY$: IF a$<>" " THEN 1310
1320 CLS
1330 BORDER 8
1340 RETURN
1350 IF d%=1 OR d%=3 OR d%=5 OR d%=7 THEN PAPER 0 ELSE PAPER 1
1360 RETURN
1370 IF d%=2 OR d%=4 OR d%=6 OR d%=8 THEN PAPER 0 ELSE PAPER 1
1380 RETURN
1390 IF b%=1 OR b%=3 OR b%=5 OR b%= 7 THEN PAPER 0 ELSE PAPER 1
1400 RETURN
1410 IF b%=2 OR b%=4 OR b%=6 OR b%=8 THEN PAPER 0 ELSE PAPER 1
1420 RETURN