10 REM Master Mind
20 REM by Carl Wheat
30 REM for Public Domain
40 :
50 VDU23,240,255,255,255,255,255,255,
255,255,23,241,0,60,126,126,126,126,60,0
,23,242,60,66,129,129,129,129,66,60
60 B$=" ":DIM G(4):DIM A(4):DIM T(4)
70 P$=B$+CHR$(242)
80 C$=B$+CHR$(241)
90 A$=P$+P$+P$+P$
100 MODE 7:PROCTITLE
110 MODE 2:VDU 23;8202;0;0;0;
120 C%=1:L%=3:K$=" "
130 PRINT TAB(3,29)"";
140 FOR I%=1 TO 7
150 COLOUR I%
160 PRINT " ";CHR$(240);:NEXT
170 PRINT TAB(4,31)"R G Y B M C W"
180 PRINT TAB(5,1)"GUESS RESULT"
190 PRINT TAB(0,26)C$" COLOUR ";P$;" P
LACED"
200 I%=RND(-TIME)
210 FOR I%=1 TO 4
220 A(I%)=RND(7):NEXT
230 Z%=0
240 R$=""
250 FOR I%=1 TO 4
260 T(I%)=A(I%):NEXT
270 COLOUR 7
280 IF C%<10 THEN PRINT TAB(1,L%);C%;"
"; ELSE PRINT TAB(1,L%);C%;
290 I%=0
300 REPEAT
310 X=GET : PROCCONVERT
320 IF X=81 PROCLOSE
330 IF K$="Y" GOTO 110
340 IF K$="N" END
350 IF X=127 AND I%<>0 THEN I%=I%-1 :V
DU127,127
360 COLOUR X
370 IF X<8 THEN PRINT " ";CHR$(240);
380 UNTIL I%=4
390 COLOUR 8:PRINT " RETURN"
400 X=GET
410 IF X=127 THEN VDU X,X,X,X,X,X,X,X,
X,X,X:I%=3:GOTO300
420 IF X<>13 GOTO 400
430 VDU127,127,127,127,127,127,127,127
440 C%=C%+1:L%=L%+2
450 FOR I%=1 TO 4
460 IF T(I%)=G(I%) R$=R$+P$:T(I%)=9:G(
I%)=8
470 NEXT
480 FOR I%=1 TO 4:FOR J%=1 TO 4
490 IF T(I%)=G(J%) R$=R$+C$:T(I%)=9:G(
J%)=8
500 NEXT J%:NEXT I%
510 COLOUR 7
520 PRINT R$
530 IF R$=A$ PROCFINISH
540 IF K$="Y" GOTO 110
550 IF K$="N" END
560 IF C%>10 AND R$<>A$ THEN PROCLOSE
ELSE GOTO 240
570 IF K$="Y" GOTO 110
580 IF K$="N" END
590 DEFPROCCONVERT
600 IF X=82 THEN X=1
610 IF X=71 THEN X=2
620 IF X=89 THEN X=3
630 IF X=66 THEN X=4
640 IF X=77 THEN X=5
650 IF X=67 THEN X=6
660 IF X=87 THEN X=7
670 IF X<=7 THEN I%=I%+1 : G(I%)=X
680 ENDPROC
690 DEFPROCFINISH
700 PRINT TAB(1,26)SPC(96)
710 PRINT TAB(6,L%+3)"CORRECT"
720 REPEAT : PRINT TAB(3,L%+5)"ANOTHER
GO Y/N ?":K$=GET$ : UNTIL K$="Y" OR K$=
"N"
730 IF K$="N" THEN CLS : PRINT TAB(7,1
2)"THE END"
740 ENDPROC
750 DEFPROCLOSE
760 COLOUR 7
770 PRINT TAB(1,26)" YOU LOSE ";
780 FOR I%=1 TO 4
790 COLOUR(A(I%))
800 PRINT" ";CHR$(240);:NEXT
810 PRINT TAB(4,28)" "
820 PRINT TAB(4,30)" "
830 COLOUR 7
840 REPEAT:PRINT TAB(3,29)"ANOTHER GO
Y/N ?":K$=GET$:UNTIL K$="Y" OR K$="N"
850 IF K$="N" THEN CLS : PRINT TAB(7,1
2)"THE END"
860 ENDPROC
870 DEFPROCTITLE
880 VDU23;8202;0;0;0;
890 T$="Public Domain "
900 FOR I%=2 TO 3:PRINTTAB(8,I%)CHR$14
1CHR$129CHR$157CHR$135T$CHR$156:NEXT
910 T$="Master Mind by Carl Wheat"
920 PRINTTAB(4,6)CHR$141T$
930 PRINTTAB(4,7)CHR$141T$
940 PRINTTAB(0,11)"You have to guess f
our random colour blocks by pressing
the colour keys as shown. ";CHR$(162);
"DELETE";CHR$(162);" can be used."
950 PRINTTAB(2,15)CHR$(255);" - SHOWS
A CORRECT COLOURED BLOCK INCORR
ECTLY PLACED"
960 PRINTTAB(2,18)"O - SHOWS A CORRECT
LY PLACED COLOURED BLOCK"
970 PRINTTAB(6,21)"You can press ";CHR
$(162);"Q";CHR$(162);" to quit."
980PRINTTAB(9,24)CHR$129CHR$157CHR$135
"Press Any Key "CHR$156:K%=GET:ENDPROC