!*! Updated on 08-Nov-90 at 12:28 PM by Paul Ciosek; edit time: 0:00:51 !*************************** AMUS Program Label ****************************** ! Filename: MASTMD.RUN Date: 11/8/90 ! Category: Hash Code: 737-703-541-565 Version: 1.0(1) ! Initials: Name: G. KIRBY ! Company: PROTECH DATA SYSTEMS Telephone #: ! Related Files: mastmd.dat ! Min. Op. Sys.: Expertise Level: INT ! Special: need to load input.sbr to run ! Description: mastermind game, quite fun ! ! !***************************************************************************** !*! Updated on 01-Nov-90 at 11:05 AM by Paul Ciosek; edit time: 0:04:56 ! MASTERMIND BOARD MAP1 BOARD MAP2 TOP,S,1,"-" MAP2 SIDE,S,1,"!" MAP2 ENTRY,S,10 MAP2 ANSWER,S,10 MAP2 GUESS,S,10 MAP2 ANSWER1,S,10 MAP1 KEY,F,6 MAP1 MSGE,S,27 MAP1 BOARDL MAP2 TOPL,S,47," ZPZ " MAP2 MIDL,S,47," ZXZ " MAP2 BOTL,S,47," Z=Z " MAP2 SIDEL,S,47," V " MAP2 QST,S,25," V " MAP2 ANSWER2,S,25," V " MAP1 NM1,S,39," E-T-S-A-M" MAP1 NM2,S,39,"R-M-I-N-D " MAP1 NAME,S,10,"MASTEDNIMR" MAP1 TRMCHR'MAP MAP2 TRMCHR'FLAGS,F,6 MAP2 TRMCHR'FILL(7),F,6 INST: 250 PRINT TAB(-1,0) : XCALL NOECHO : FILEBASE 1 : RANDOMIZE CALL DRAW'HEADER CALL INSTRUCTION ?TAB(2,1);TAB(-1,10); SCOREBOARD: ?TAB(2,1);TAB(-1,36); Y=1 : W=19 : X=60 : H=1 : CALL DRAW'BOX Y=4 : W=19 : X=60 : H=3 : CALL DRAW'BOX ?TAB(-1,23); FOR I=62 TO 78 : ?TAB(3,I);"P";TAB(4,I);"="; : NEXT I FOR I=62 TO 79 : ?TAB(6,I);"Z"; : NEXT I ?TAB(6,60);"TZ";TAB(6,80);"Y";TAB(4,72);"X";TAB(8,72);"="; & TAB(5,72);"V";TAB(6,72);"X";TAB(7,72);"V"; ?TAB(8,63);"PP";TAB(8,76);"PP"; ?TAB(9,62);"R==S";TAB(9,75);"R==S";TAB(10,62);"7777";TAB(10,75);"7777"; ?TAB(2,79);TAB(-1,24);TAB(-1,33);TAB(2,61);TAB(-1,32);"<<<SCORE-BOARD>>>" PRINT TAB(5,61); "GAMES WON"; TAB(7,61); "GAMES LOST" : CALL SCORES Y=12 : W=19 : X=60 : H=3 : CALL DRAW'BOX Y=17 : W=29 : X=50 : H=1 : CALL DRAW'BOX ?TAB(19,62);TAB(-1,23);"P";TAB(19,80);"Y";TAB(20,62); & "V";TAB(20,80);"V";TAB(21,62); & "QZZZZZZZZZZZZZZZZZU";TAB(-1,24);TAB(-1,37); CLEAR: 100 ! CLEAR FIELDS ?TAB(20,63);SPACE(17);TAB(23,48);TAB(-1,9); CALL RESET'BOARD GETLEN: PRINT TAB(13,78);TAB(-1,33);TAB(13,61);TAB(-1,32); & "HOW MANY NUMBERS:";TAB(-1,33);TAB(15,61);SPACE(17); XCALL INPUT,15,69,2,1,"#E",ENTRY,INXCTL,1 IF INXCTL = 2 GOTO ENDIT NOM = VAL(ENTRY) IF NOM < 1 OR NOM > 10 GOTO GETLEN GETSIZ: 350 FOR COUNT = 1 TO NOM TOPL[(COUNT*2)+24;2] = "ZZ" : TOPL[23-(COUNT*2);2] = "ZZ" : QST[23-(COUNT*2);2] = "? " BOTL[(COUNT*2)+24;2] = "ZZ" : BOTL[23-(COUNT*2);2] = "ZZ" MIDL[(COUNT*2)+24;2] = "ZZ" : MIDL[23-(COUNT*2);2] = "ZZ" NEXT COUNT NOM = NOM * 2 TOPL[21-NOM;2] = "RZ" : TOPL[26+NOM;2] = "ZS" MIDL[21-NOM;2] = "TZ" : MIDL[26+NOM;2] = "ZY" BOTL[21-NOM;2] = "QZ" : BOTL[26+NOM;2] = "ZU" SIDEL[21-NOM;2] = "V " : SIDEL[26+NOM;2] = " V" QST[21-NOM;2] = "V " : ANSWER2[21-NOM;2] = "V " NOM = NOM/2 PRINTIT: 400 PRINT TAB(4,1);TAB(-1,23);TAB(6,1); MIDL; TAB(5,1); SIDEL; & TAB(5,1); QST; TAB(4,1); TOPL GOES = NOM + 4 : IF NOM >8 THEN GOES = GOES + 1 FOR COUNT = 1 TO GOES PRINT TAB(6+COUNT,1); SIDEL NEXT COUNT PRINT TAB(6+COUNT,1); BOTL;TAB(-1,24); GETVAL: 450 FOR COUNT = 1 TO NOM ANS = INT((RND(10)*9)+1) : IF ANS > 9 ANS = 9 ANSWER = ANSWER+STR(ANS) NEXT COUNT TRY = 0 GUESSIT: 500 TRY = TRY+1 : IF TRY > GOES GOTO LOSTIT PRINT TAB(13,78);TAB(-1,33);TAB(13,61);TAB(-1,32);" MAKE YOUR GUESS ";TAB(-1,33); XCALL INPUT,15,70-(INT(NOM/2)),NOM,1,"A ",ENTRY,INXCTL,1 GUESS = ENTRY IF LEN(GUESS) < NOM GOTO GUESSIT IF GUESS # INT(GUESS) GOTO GUESSIT ?TAB(13,61);" ENTER YOUR GUESS"; ANSWER1 = ANSWER PRIGSS: 550 STRY = NOM : FOR COUNT = 1 TO NOM ANSWER2[23-(COUNT*2),23-(COUNT*2)] = GUESS[STRY,STRY] : STRY = STRY-1 NEXT COUNT G=INSTR(1,ANSWER2,"V") : G1=INSTR(G+1,ANSWER2,"V") PRINT TAB(TRY+6,2+G); ANSWER2[G+2,G1-1]; & TAB(TRY+6,2+G+G1+1);ANSWER2[G1+2,25]; IF GUESS = ANSWER CALL GOTIT : GOTO MOREPLAY CHECKIT: 600 STRY = 0 : FOR COUNT = 1 TO NOM IF GUESS[COUNT,COUNT] = ANSWER1[COUNT,COUNT] THEN GUESS[COUNT,COUNT] = " " : & ANSWER1[COUNT,COUNT] = " " : STRY = STRY + 1 : PRINT TAB(TRY+6,24+(STRY*2)); "X" NEXT COUNT FOR COUNT = 1 TO NOM IF GUESS[COUNT,COUNT] # " " CALL CHECK NEXT COUNT GOTO GUESSIT CHECK: 650 LOOK = 0 : FOR COUNT1 = 1 TO NOM IF LOOK = 1 GOTO NEXTBIT IF GUESS[COUNT,COUNT] # ANSWER1[COUNT1,COUNT1] GOTO NEXTBIT LOOK = 1 : STRY = STRY+1 : PRINT TAB(TRY+6,24+(STRY*2)); "O" ANSWER1[COUNT1,COUNT1] = " " NEXTBIT: 700 NEXT COUNT1 RETURN LOSTIT: 1000 CALL PRANS : CALL LOSTMSGE PRINT TAB(18,79);TAB(-1,35);TAB(18,51);TAB(-1,34);MSGE;TAB(-1,35); ?TAB(20,63);"<<< YOU LOSE >>>"; LOST = LOST + 1 : CALL SCORES GOTO MOREPLAY GOTIT: 1010 STRY = NOM : FOR COUNT = 1 TO NOM PRINT TAB(TRY+6,24+(COUNT*2)); "X" PRINT TAB(5,23-(COUNT*2)); GUESS[STRY,STRY] : STRY = STRY-1 NEXT COUNT WON = WON + 1 : CALL SCORES 1014 IF TRY = 1 GOTO INONE CALL WONMSGE PRINT TAB(18,79);TAB(-1,35);TAB(18,51);TAB(-1,34);MSGE;TAB(-1,35); ?TAB(20,63);"<<<< YOU WIN >>>>"; 1016 RETURN INONE: KEY = 1 CALL READMSG 1020 MSGE="YOU LUCKY ** BASTARD YOU **" PRINT TAB(18,79);TAB(-1,35);TAB(18,51);TAB(-1,34);MSGE;TAB(-1,35); ?TAB(20,63);"<<<< YOU WIN >>>>"; RETURN MOREPLAY: ! NO NOT FOREPLAY 1030 PRINT TAB(23,48); "CARE TO PLAY AGAIN...(Y/N) : "; ANSWER = "" : TRY = 0 : CLOSE #1 XCALL INPUT,23,77,1,1,"YY",ENTRY,INXCTL,1 ?TAB(18,51);SPACE(29); IF UCS(ENTRY[1,1]) = "Y" GOTO CLEAR ?TAB(23,48);"OH GO ON.....PLEEEEASE !!! "; XCALL INPUT,23,76,1,1,"YY",ENTRY,INXCTL,1 IF UCS(ENTRY[1,1]) = "Y" GOTO CLEAR PRINT TAB(-1,0);"S C A R E D Y C A T"; : FOR I = 1 TO 2000 : NEXT I CHAIN "MN.RUN[110,13]" PRANS: 1100 STRY = NOM : FOR COUNT = 1 TO NOM PRINT TAB(5,23-(COUNT*2)); ANSWER[STRY,STRY] : STRY = STRY-1 NEXT COUNT RETURN SCORES: IF WON>LOST GOTO S'WON IF LOST>WON GOTO S'LOST PRINT TAB(5,61); "GAMES WON"; TAB(7,61); "GAMES LOST"; 1110 PRINT TAB(5,74); WON USING "#,###"; TAB (7,74); LOST USING "#,###" RETURN S'WON: PRINT TAB(5,61); "GAMES";TAB(-1,21);"WON";TAB(-1,22); & TAB(7,61); "GAMES LOST"; PRINT TAB(5,74); WON USING "#,###"; TAB (7,74); LOST USING "#,###" RETURN S'LOST: PRINT TAB(7,61); "GAMES";TAB(-1,21);"LOST";TAB(-1,22); & TAB(5,61); "GAMES WON "; PRINT TAB(5,74); WON USING "#,###"; TAB (7,74); LOST USING "#,###" RETURN LOSTMSGE: 1120 KEY = INT(RND(8)*16)+1 : IF KEY < 9 GOTO LOSTMSGE CALL READMSG RETURN WONMSGE: 1150 KEY = INT(RND(8)*8)+1 : IF KEY>8 GOTO WONMSGE CALL READMSG RETURN READMSG: 1155 OPEN #1,"MASTMD.DAT",INPUT FOR COUNT = 1 TO KEY INPUT LINE #1,MSGE NEXT COUNT RETURN INSTRUCTION: 1160 PRINT TAB(12,23);"DO YOU REQUIRE INSTRUCTIONS Y/N " : INS = 1 XCALL INPUT,12,58,1,0,"AE",ENTRY,INXCTL,1 IF UCS(ENTRY[1,1]) = "Y" GOTO INSTRUCTIONS RETURN ENDIT: 1170 PRINT TAB(-1,0) : CHAIN "MN.RUN" ! QUIT TO MENU PROGRAM INSTRUCTIONS: 1200 PRINT TAB(2,1);TAB(-1,10); & "The object of this game is to correctly guess the hidden numbers that the" ?"computer has picked. How many numbers, however, will be chosen by you." ?"" ?"You will be asked how many numbers you wish to guess (between 1 and 10)" ?"...If you choose 1 number then that could be anything from 1 to 9" ?"...If you choose 2 numbers then that could be anything from 11 to 99" ?"...If you choose 3 number then that could be anything from 111 to 999" ?"" ?"When you make your guess you will be told how close you were....you will" ?"be shown an X for a correct number in the correct position and " ?" O for a correct number in the wrong position" ?"" ?"For example If you asked for 4 numbers and the hidden answer is 2324" ?" your guess may be 6423 this would result in you being " ?" given three 'pegs' X O O as to how close you were" ?" - - - " ?"The X would be because you had correctly guessed the position of the" ?"number 2 in the answer. The O O because two other numbers were correctly" ?"guessed but not in the right positions (the 3 & 4 are in the wrong place)." ?"You would NOT get an X and an O for the number 2 in your guess as you" ?"only get a maximum of one 'peg' per number." input "HAVE A MIND NUMBING GOOD TIME..............RETURN TO CONTINUE",dummy RETURN DRAW'HEADER: ?TAB(-1,0);TAB(-1,29);TAB(-1,23);TAB(-1,36); PRINT TAB(1,51);TAB(-1,33);TAB(1,30);TAB(-1,32); & " ";TAB(-1,33); & TAB(23,38);"QZZZZU";TAB(22,38);"S R"; FOR I=1 TO 37 : ?TAB(22,I);"Z"; : IF I<37 ?TAB(22,43+I);"Z"; NEXT I ?TAB(-1,24); ?TAB(23,1);TAB(-1,11);"Courtesy of G. Kirby"; & TAB(23,60);"Protech Data Systems";TAB(-1,12);TAB(-1,37); X=21 : Y=21 FOR I=1 TO 37 R=INT(RND(30)*10)+1 IF I<4 OR I>33 R=10 IF R<3 AND X1=0 X1=1 ELSE IF R<5 AND Y1=0 Y1=1 IF X1<>0 X=X-X1 : IF X<19 X1=-1 : X=19 IF Y1<>0 Y=Y-Y1 : IF Y<19 Y1=-1 : Y=19 IF X>21 X=21 : X1=0 IF Y>21 Y=21 : Y1=0 FOR DELAY=1 TO 900 : NEXT DELAY IF X=19 ?TAB(19,I);" ";NM1[39;1]; : & ?TAB(20,I-1);" /"; : & ?TAB(21,1);NM1[40-I;I-2]; IF X=20 ?TAB(19,I);" "; & TAB(20,I-1);" ";NM1[39;1]; : & ?TAB(21,1);NM1[40-I;I-1]; IF X=21 ?TAB(20,I-1);" "; & TAB(21,1);NM1[40-I;I]; IF Y=19 ?TAB(19,79-I);NM2[1;1];" "; : & ?TAB(20,80-I);"\ "; : & ?TAB(21,81-I);NM2[3;I]; IF Y=20 ?TAB(19,80-I);" "; & TAB(20,80-I);NM2[1;1];" "; : & ?TAB(21,81-I);NM2[2;I-1]; IF Y=21 ?TAB(20,80-(I-1));" "; & TAB(21,81-I);NM2[1;I]; NEXT I JUMP'INTO'POT: FOR I=1 TO 9 : FOR DELAY=1 TO 900 : NEXT DELAY IF I=1 ?TAB(20,38);"\";TAB(19,34);"aaah"; ?TAB(21,28+I);" ";NM1[30,38-I];TAB(22,40);NM1[40-I;1]; NEXT I : ?TAB(22,40);" "; FOR I=1 TO 9 : FOR DELAY=1 TO 900 : NEXT DELAY IF I=1 ?TAB(19,34);" ";TAB(20,38);" "; : & ?TAB(20,43);"/";TAB(19,44);"aaah"; ?TAB(21,44);NM2[I+1,39];TAB(22,41);NM2[I;1]; NEXT I : ?TAB(22,41);" ";TAB(21,44);" ";TAB(20,43);" ";TAB(19,44);" "; CROSS: ?TAB(22,35);TAB(-1,23);"U Q";TAB(21,35);"V V";TAB(20,34);"QS RU"; ?TAB(19,34);"RU QS";TAB(18,35);"RZS";TAB(-1,24); RISE'FROM'POT: FOR I1=1 TO 10 FOR I=21 TO 2 STEP-1 : ?TAB(I,40);NAME[I1;1];TAB(I+1,40);" "; FOR DELAY=1 TO 200 : NEXT DELAY NEXT I X=(I1*2)-1 IF I1>5 X1=11-I1 : X=((X1+10)+(X1-1)) ?TAB(1,30+X);NAME[I1;1];TAB(2,40);" "; : NEXT I1 ?TAB(4,1);TAB(-1,28); RETURN !-------------------------------------------------------------------------- ! Y = ROW X = COL ! W = WIDTH H = HEIGHT DRAW'BOX: XCALL TRMCHR,STATUS,TRMCHR'MAP IF TRMCHR'FLAGS AND 524288 GOTO AM62A 6000 PRINT TAB(-1,23);TAB(Y,X);TAB(-1,38); FOR I = (X+1) TO (X+W) : PRINT TAB(-1,46); : NEXT I PRINT TAB(-1,39); FOR I = (Y+1) TO (Y+H) : PRINT TAB(I,(X+W+1));TAB(-1,47); : NEXT I PRINT TAB((Y+H+1),(X+W+1));TAB(-1,41); FOR I = (X+W) TO (X+1) STEP -1 : PRINT TAB((Y+H+1),I);TAB(-1,46); : NEXT I PRINT TAB((Y+H+1),X);TAB(-1,40); FOR I = (Y+H) TO (Y+1) STEP -1 : PRINT TAB(I,X);TAB(-1,47); : NEXT I PRINT TAB(-1,24); 6050 RETURN AM62A: HH = H + 32 : WW = W + 32 PRINT TAB(Y,X); TAB(-1,92); CHR(HH); CHR(WW); RETURN RESET'BOARD: TOPL=" ZPZ " MIDL=" ZXZ " BOTL=" Z=Z " SIDEL=" V " QST=" V " ANSWER2=" V " ?TAB(2,1);TAB(-1,91);CHR(54);CHR(81);" "; RETURN