logo
MasterMind   Home  |  Send Your Feedback

MasterMind

This applet plays MasterMind.   See how quickly it can find your secret selection.
To begin, choose a pattern of colors, and click Play.



A row of discs shows the available colors.
Choose a set of four or five, and remember it or write it down.
Repeat of colors is allowed.

Default size is 5, click "Change size" to switch between 4 and 5.

Click PLAY to start the applet trying to guess your selection.
When a guess appears, you inform the applet of its accuracy by clicking some or all of the small squares at the right.

Click once to make a square black, indicating a disc of the right color in the right position.

Click again to make the square white, indicating a disc of the right color, but in the wrong position.

A third click of a square returns it to empty, in case corrections are needed.

Leave open one square for each disc which is missing from the selection.
The squares are NOT positional - choose any of them for any of the positions in the guess.
When you are finished clicking the squares (0 to 4 or 5 might then be filled), click READY to see the next guess.

A short cut to confirming all are correct is the "That's it" button.

To try another selection, click PLAY.

If no more guesses are possible, "I give up" is displayed. This means that you have made an error in giving the results.
The algorithm used is very simple, and very effective.

Guesses are random, but they must be possible.
That is, after each guess, the number of patterns is reduced to those that match all guesses so far, and one of those remaining is chosen at random.

How well does this algorithm work? As shown by the numbers below, every first guess, no matter how successful it is or not, reduces the number of possible patterns by around 75% or better.

5 Pegs, 10 Colors - 100,000 patterns

 

4 Pegs, 10 Colors - 10,000 patterns

1-1-1-1-1 guess:
- ( ) -> 3124
- B -> 6479
- W -> 16774
- B B -> 3429
- B W -> 15239
- W W -> 25129

2-1-1-1 guess:
- ( ) -> 7775
- B -> 9795
- W -> 23777
- B B -> 3936
- B W -> 15251
- W W -> 20726

2-2-1 guess:
- ( ) -> 16806
- B -> 13699
- W -> 26270
- B B -> 4443
- B W -> 14255
- W W -> 13021

3-1-1 guess:
- ( ) -> 16806
- B -> 15394
- W -> 28531
- B B -> 4829
- B W -> 13651
- W W -> 12217

  1-1-1-1 guess:
- ( ) -> 1295
- B -> 1371
- W -> 3047
- B B -> 383
- B W -> 1259
- W W -> 1895

2-1-1 guess:
- ( ) -> 2400
- B -> 1709
- W -> 3051
- B B -> 400
- B W -> 1029
- W W -> 1013

2-2 guess:
- ( ) -> 4095
- B -> 2047
- W -> 2047
- B B -> 417
- B W -> 799
- W W -> 383

3-1 guess:
- ( ) -> 4095
- B -> 2264
- W -> 2247
- B B -> 434
- B W -> 599
- W W -> 216