Mastermind
The CPU has set a secret 4-colour code. Guess it in 10 tries. After each guess you get black pegs (right colour, right spot) and white pegs (right colour, wrong spot).
How to use
- Click a colour from the palette to place it in the next slot.
- Fill all 4 slots then click Submit to check your guess.
- Black peg = correct colour and position. White peg = correct colour, wrong position.
- Crack the code in 10 guesses or fewer.
Related tools:
Mastermind is a code-breaking game where the computer sets a secret sequence of four colors and you have 10 guesses to crack it. After each guess, you get feedback in the form of black and white pegs. A black peg means one of your colors is in the correct position. A white peg means a color is in the code but placed in the wrong spot.
The game was invented in 1970 by Mordecai Meirovitz and became one of the best-selling board games of the 1970s. The optimal strategy, worked out mathematically, can solve any code in at most five guesses. Most casual players land around 6 to 7 guesses on average. The skill is using the peg feedback to eliminate possibilities systematically rather than guessing randomly.
Frequently Asked Questions
What do the black and white pegs mean?
A black peg means a correct color in the correct position. A white peg means a correct color in the wrong position. No peg means that color is not in the code at all.
Can the same color appear more than once in the code?
Yes. The secret code can contain repeated colors, so you cannot assume each color appears at most once.
How many guesses do I get?
You get 10 guesses to crack the 4-color code.
What is the optimal strategy?
The optimal strategy uses your first guess to maximize information elimination. After that, always guess the sequence that most efficiently splits the remaining possibilities. With optimal play, any code can be solved in 5 guesses or fewer.