How to Play | Valid HTML 5 | Valid CSS 3


Please begin a game by setting your preferences and pressing the 'Start New Game' button.

The game has been initialized for a standard Mastermind game. If this is what you wish to play, then please press 'Start New Game'.

You can play with interactive help turned on by clicking the 'Instructions' button before you start a game.

How to play

The object of the game is to guess the solution code by submitting guesses to the code and asking for a result on those guesses.

  1. Select your settings
    • More pegs and/or more colors makes the game harder
    • Fewer turns makes the game harder
    • Duplicates make the game harder
    • Blanks make the game harder
    • Duplicates only apply to pegs, not blanks.
    • Blanks can always have duplicates, even if duplicates are turned off
  2. Press 'Start New Game'
  3. Select the color you wish to place
  4. Select the location you wish to place it in, if there is already a color there, it will be replaced.
  5. If 'click to place' is turned on, then you can place pegs simply by clicking on the peg you wish to place and it will fill the next available space. You can still place pegs by clicking the location you wish to place the peg, after the color has been selected, even if this option is turned on. (This option is live, meaning if you turn it off or on midway through a game, it will take effect immedately.)
  6. When all the colors (or blanks) for the current row have been placed, click on the result box (highlighted in red)
  7. The game will return a set of pegs (if any) in the response box:
    • A white peg means you got one of the colors correct, but in the wrong position
    • A red peg means you got one of the colors correct, and in the correct position
    • No pegs means that none of the colors shown is present in the solution
    • The pegs are not cumulative. i.e. if you place a blue peg on the board and the solution contains two blue pegs, you will only get one peg in response. Similarly, if you place two green pegs on the board, and the solution only contains one green peg, you will again only get one peg in response.
  8. If you guess correctly, the game is over and you win
  9. If you run out of turns, and you have not guessed the code, you lose

About this script

This script was created to be portable, meaning it is contained all in one file, you may download this file and play at home, or copy to your website with no other files needed.

Because the images in this file are embedded as Base64 encoded strings and Internet Explorer does not support this method, the script will look different in Internet Explorer. It will still work, but it will not look as it does in other compliant browsers. Pay special attention to the difference between blank spaces and black pegs (black pegs are actually a dark grey color) as they do not behave the same.