NNM Mastermind v1.0

This is an implementation of the classic Mastermind board game. Only HTML, CSS and plain JavaScript is used.

Decoding board

?
NNM Mastermind v1.0

Rules and functionality

Some of the functionality may be configured, so you can modify how difficult it will be to break the code. Decreasing the number of colors and/or the code length is a great way to learn the game. When 6 colors and a code length of 4 is too easy, you can instead increase the number of colors and/or the code length.

Code length

With the default configuration the code length is 4. You can configure the code length between 2 and 8.

Code pegs

With the default configuration there are code pegs in 6 different colors. You can configure the number of colors between 2 and 8.

Colors

The code pegs are colored:

Temporary disabled colors

The colors currently enabled are also shown below the shielded secret code/pattern. You may toggle the colors that you can choose from, by clicking the corresponding color in the row. The code pegs with matching color will also be toggled, except for code pegs in the current round. If a color is disabled, it will not be included when looping through colors, or in randomly created guesses.

Beware though, a temporary disabled color may, of course, still be hidden in the secret code.

Key pegs

The key pegs are colored:

Duplicates

Duplicates in the code are allowed.

Blanks

Blanks are not allowed in the code, but you can leave blanks in your guesses.

Number of rounds

With the default configuration the number of rounds is 10. You can configure the number of rounds between 6 and 16 (in steps by 2).

How to play

You click the holes for the current round to toggle between the enabled colors. When your guess is ready you click the corresponding Lock my guess button and the result of the round is calculated with key pegs added accordingly. If the guess is unsuccessful a new round is started.

Buttons

Start a new game.
Give up the current game. The secret code will be shown.
×
Clear the current round, i.e. remove the code pegs.
Make a random guess for the current round.
Lock the current guess and get the result.
Copy a previous guess.

More to come

In future versions some of the following functionality may be implemented.

First version of NNM Mastermind was originally implemented in August 2019 by Anders Gustafson and released September 7.