»
EnglishFrenchVietnamese

Print - Master Mind Game - JavaScriptBank.com

Full version: jsB@nk » Game » Master Mind Game
URL: https://www.javascriptbank.com/master-mind-game.html

Master Mind Game © JavaScriptBank.comThe object of the game is to guess and match your opponent's numbers/colors.

Full version: jsB@nk » Game » Master Mind Game
URL: https://www.javascriptbank.com/master-mind-game.html



JavaScript
<SCRIPT language=javascript>function colo1(){if(document.form.b2.value==1){ document.form.b3.style.backgroundColor='yellow';}if(document.form.b2.value==2){ document.form.b3.style.backgroundColor='ff0000';}if(document.form.b2.value==3){ document.form.b3.style.backgroundColor='#00ffaa';}if(document.form.b2.value==4){ document.form.b3.style.backgroundColor='#00ddff';}if(document.form.b2.value==5){ document.form.b3.style.backgroundColor='#0099ff';}if(document.form.b2.value==6){ document.form.b3.style.backgroundColor='#dd88ff';}if(document.form.b2.value==7){ document.form.b3.style.backgroundColor='#ffbb00';}if(document.form.b2.value==8){ document.form.b3.style.backgroundColor='#cccccc';}}    </SCRIPT><!--COLO2-->      <SCRIPT language=javascript>function colo2(){if(document.form.a2.value==1){ document.form.a3.style.backgroundColor='yellow';}if(document.form.a2.value==2){ document.form.a3.style.backgroundColor='ff0000';}if(document.form.a2.value==3){ document.form.a3.style.backgroundColor='#00ffaa';}if(document.form.a2.value==4){ document.form.a3.style.backgroundColor='#00ddff';}if(document.form.a2.value==5){ document.form.a3.style.backgroundColor='#0099ff';}if(document.form.a2.value==6){ document.form.a3.style.backgroundColor='#dd88ff';}if(document.form.a2.value==7){ document.form.a3.style.backgroundColor='#ffbb00';}if(document.form.a2.value==8){ document.form.a3.style.backgroundColor='#cccccc';}}    </SCRIPT><!--COLO3-->      <SCRIPT language=javascript>function colo3(){if(document.form.c2.value==1){ document.form.c3.style.backgroundColor='yellow';}if(document.form.c2.value==2){ document.form.c3.style.backgroundColor='ff0000';}if(document.form.c2.value==3){ document.form.c3.style.backgroundColor='#00ffaa';}if(document.form.c2.value==4){ document.form.c3.style.backgroundColor='#00ddff';}if(document.form.c2.value==5){ document.form.c3.style.backgroundColor='#0099ff';}if(document.form.c2.value==6){ document.form.c3.style.backgroundColor='#dd88ff';}if(document.form.c2.value==7){ document.form.c3.style.backgroundColor='#ffbb00';}if(document.form.c2.value==8){ document.form.c3.style.backgroundColor='#cccccc';}}    </SCRIPT><!--COLO4-->      <SCRIPT language=javascript>function colo4(){if(document.form.d2.value==1){ document.form.d3.style.backgroundColor='yellow';}if(document.form.d2.value==2){ document.form.d3.style.backgroundColor='ff0000';}if(document.form.d2.value==3){ document.form.d3.style.backgroundColor='#00ffaa';}if(document.form.d2.value==4){ document.form.d3.style.backgroundColor='#00ddff';}if(document.form.d2.value==5){ document.form.d3.style.backgroundColor='#0099ff'; document.form.d3.style.fontColor='white';}if(document.form.d2.value==6){ document.form.d3.style.backgroundColor='#dd88ff';}if(document.form.d2.value==7){ document.form.d3.style.backgroundColor='#ffbb00';}if(document.form.d2.value==8){ document.form.d3.style.backgroundColor='#cccccc';}}    </SCRIPT><!--COLO5-->      <SCRIPT language=javascript>function colo5(){if(document.form.e2.value==1){ document.form.e3.style.backgroundColor='yellow';}if(document.form.e2.value==2){ document.form.e3.style.backgroundColor='ff0000';}if(document.form.e2.value==3){ document.form.e3.style.backgroundColor='#00ffaa';}if(document.form.e2.value==4){ document.form.e3.style.backgroundColor='#00ddff';}if(document.form.e2.value==5){ document.form.e3.style.backgroundColor='#0099ff';}if(document.form.e2.value==6){ document.form.e3.style.backgroundColor='#dd88ff';}if(document.form.e2.value==7){ document.form.e3.style.backgroundColor='#ffbb00';}if(document.form.e2.value==8){ document.form.e3.style.backgroundColor='#cccccc';}}    </SCRIPT>      <SCRIPT language=javascript><!--function hideThis(layerId){if (document.layers){document.layers[layerId].visibility = "hide";} else { document.all[layerId].style.visibility = "hidden";}}function showThis(layerId){if (document.layers){document.layers[layerId].visibility = "show";} else { document.all[layerId].style.visibility = "visible";}}//-->    </SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<TABLE borderColor=#000000 border=4>  <TBODY>  <TR>    <TD><!--FIRST TABLE-->      <TABLE height=310 width=620 align=center bgColor=#ffffee border=2>        <TBODY>        <TR>          <TD vAlign=top bgColor=#ffffff><!--TABLE 1 INSIDE TABLE-->            <CENTER>            <TABLE width=310>              <TBODY>              <TR>                <TD colSpan=8><FONT size=3>                  <CENTER>Color/Number Key</CENTER></FONT></TD></TR>              <TR vAlign=bottom>                <TD align=right width=30 height=30><B>1=</B></TD>                <TD align=left width=20 bgColor=yellow height=10></TD>                <TD align=right width=30 height=30><B>2=</B></TD>                <TD align=left width=20 bgColor=#ff0000 height=10></TD>                <TD align=right width=30 height=30><B>3=</B></TD>                <TD align=left width=20 bgColor=#00ffaa height=10></TD>                <TD align=right width=30 height=30><B>4=</B></TD>                <TD align=left width=20 bgColor=#00ddff height=10></TD></TR><BR>              <TR>                <TD colSpan=4 height=5></TD></TR>              <TR>                <TD align=right width=30 height=30><B>5=</B></TD>                <TD align=left width=20 bgColor=#0099ff height=10></TD>                <TD align=right width=30 height=30><B>6=</B></TD>                <TD align=left width=20 bgColor=#dd88ff height=10>                <TD align=right width=30 height=30><B>7 =</B> </TD>                <TD align=left width=20 bgColor=#ffbb00 height=10></TD>                <TD align=right width=30 height=30><B>8 =</B> </TD>                <TD align=left width=20 bgColor=#cccccc height=10></TD></TR>              <TR>                <TD colSpan=8><BR><BR>                  <CENTER>click the following button to see how to play<BR>                  <FORM><INPUT onclick='showThis("hint");' type=button value="open rules" name=rc_password_hint>                   </FORM></FONT></CENTER></TD><!--HERE--></TR></TBODY></TABLE></CENTER></TD><!--END OF TABLE 1 INSIDE TABLE--><!--TABLE 2 INSIDE TABLE-->          <TD vAlign=top bgColor=#eeeeee>            <FORM name=form>            <TABLE cellSpacing=4 cellPadding=3 bgColor=#eeeeee border=0             valign="top">              <TBODY>              <TR>                <TD vAlign=bottom><B><FONT face=Arial size=2># of guesses:</FONT></B> <INPUT size=5 value=0 name=turn>                   &nbsp;&nbsp;&nbsp;<INPUT onclick=" if(this.form.hidd.value=='4') this.form.a3.style.backgroundColor='white';&#13;&#10; this.form.b3.style.backgroundColor='white';&#13;&#10;  this.form.c3.style.backgroundColor='white';&#13;&#10;this.form.d3.style.backgroundColor='white';&#13;&#10;this.form.e3.style.backgroundColor='white';" type=reset value="reset board" name=reset></TD></TR>              <TR>                <TD align=middle width=300 bgColor=#ddaaff height=40                   border="2"><INPUT type=hidden value=4 name=hidd> <INPUT                   type=password size=5 name=b1> <INPUT type=password size=5                   name=a1> <INPUT type=password size=5 name=c1> <INPUT                   type=password size=5 name=d1> <INPUT type=password size=5                   name=e1> </TD></TD>              <TR>                <TD height=5></TD></TR></TD>              <TR>                <TD vAlign=center align=middle bgColor=#aa4455                   height=40><INPUT size=5 name=b3> <INPUT size=5 name=a3> <INPUT                   size=5 name=c3> <INPUT size=5 name=d3> <INPUT size=5 name=e3>                 </TD></TR>              <TR>                <TD height=10></TD>              <TR>                <TD align=middle bgColor=#66cc66 height=40><INPUT size=5                   name=b2> <INPUT size=5 name=a2> <INPUT size=5 name=c2> <INPUT                   size=5 name=d2> <INPUT size=5 name=e2> </TD></TR></TBODY></TABLE><BR>            <CENTER><INPUT onclick=" this.form.turn.value=((this.form.turn.value) - (-1));&#13;&#10; if(this.form.b1.value==this.form.b2.value) this.form.b3.value=this.form.b1.value;&#13;&#10;colo1();&#13;&#10;if(this.form.a1.value==this.form.a2.value) this.form.a3.value=this.form.a1.value;&#13;&#10;colo2();&#13;&#10;if(this.form.c1.value==this.form.c2.value) this.form.c3.value=this.form.c1.value;&#13;&#10;colo3();&#13;&#10;if(this.form.d1.value==this.form.d2.value) this.form.d3.value=this.form.d1.value;&#13;&#10;colo4();&#13;&#10;if(this.form.e1.value==this.form.e2.value)  this.form.e3.value=this.form.e1.value;&#13;&#10; colo5();" type=button value="submit guesses" name=but>             </FORM>            <FORM><INPUT onclick=" document.form.b1.value = fortune(); document.form.a1.value = fortune(); document.form.c1.value = fortune(); document.form.d1.value = fortune(); document.form.e1.value = fortune();" type=button value="play computer" name=ask>             </FORM></CENTER></TD></TR><!--END OF TABLE 2 INSIDE TABLE--><!--TABLE 3 INSIDE TABLE--></TD></TR></TBODY></TABLE><DIV id=hint       style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; Z-INDEX: 6; LEFT: 16px; VISIBILITY: hidden; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; POSITION: absolute; TOP: 20px; BACKGROUND-COLOR: #eeeeee">      <TABLE borderColor=#000000 height=315 cellSpacing=0 cellPadding=4       width=320 align=left bgColor=#eeeeee border=2 valign="top">        <TBODY>        <TR>          <TD class=text vAlign=top><FONT face=arial color=#8866aa size=2>            <CENTER><B>Rules</B></CENTER>The object of the game is to guess and match your opponent&#39;s numbers/colors. &nbsp;<BR>The Game can be played between <SPAN             onmouseover="self.status='---------------click here for more information on a two player game--------------'; return true"             onclick="alert('when playing with two people, one person inserts their choice of numbers (1-8) into the first row (one number per input box). The other player then tries to guess the first players numbers by inserting their guesses into the third row, and then clicking the submit guesses button. When all of the number/colors are matched, the input box labeled # of guesses  will tell you how many times it took you to get them all right. After that then the two players rotate. the person who gets them all right in the fewest tries wins!                                             hitting the reset board button will reset the playing board values, the colors in the second row will stay, but they will change with new guesses.')"             onmouseout="self.status='';return true"><B><U>two people</B></U></SPAN> or a person and <SPAN             onmouseover="self.status='---------------click here for more information on playing a game with the computer--------------'; return true"             onclick="alert('If you do not have another person to play against, you can play the computer.  All you have to do is click the play computer button. the computer will automatically insert numbers (1-8) into the first row of input boxes. Then you try to guess the numbers that the computer selected by inserting your guesses into the input boxes in the third row (one number per input box). (rules are the same when playing against another person).')"             onmouseout="self.status='';return true"><B><U>the computer</B></U></SPAN>.<BR><SPAN             onmouseover="self.status='--------------click here for more details on the first row---------------'; return true"             onclick="alert('the first row is where one of the players, (a person or the computer), puts his or her selected numbers 1-8 (one number per input box). You will notice that no matter what you type in, the value looks like an * .')"             onmouseout="self.status=''; return true"><B><U>The First row</U></B></SPAN> of input boxes, to the right, are high-lighted in light purple<BR><SPAN             onmouseover="self.status='--------------click here for more details on the second row---------------'; return true"             onclick="alert('the second row is where the players guesses ar verifiied. If the player guesses right, the input box right above the guess will turn the corrisponding color of his/her guess, and the number that the player guessed will also show up. If the player guesses wrong, only the color will show up.(no number means you got it wrong).')"             onmouseout="self.status=''; return true"><B><U>The Second row</U></B></SPAN> of input boxes, to the right, are high-lighted in burgandy<BR><SPAN             onmouseover="self.status='--------------click here for more details on the third row---------------'; return true"             onclick="alert('the third row is where the player inserts his/her guesses on what the first row values are. After inserting his/her guessses, the player will need to click the submit guessses button.  If the player guesses right, the input box right above the guess will turn the corrisponding color of his/her guess, and the number that the player guessed will also show up. If the player guesses wrong, only the color will show up.(no number means you got it wrong).')"             onmouseout="self.status=''; return true"><B><U>The Third row</U></B></SPAN> of input boxes, to the right, are high-lighted in dark green<BR>            <CENTER>            <FORM><INPUT onclick='hideThis("hint");' type=button value="close rules" name=rc_pasword_hint>             </FORM></CENTER><BR><FONT color=#000000 size=1><B>Note: All underlined text can be clicked on for further information.</B></FONT> </FONT></TD></TR></TBODY></TABLE></DIV>      <SCRIPT language=JavaScript>var answers = new Array('1','2','3','4','5','6','7','8');function fortune() {num = Math.round( (answers.length -1) * Math.random());return answers[num];}    </SCRIPT>  </TR></TBODY></TABLE><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->