Mastermind Game Online
Crack the secret color code in as few guesses as possible. Each guess gets black and white pegs as clues. Or switch roles and watch the computer try to crack your code.
Attempt 1 of 10
Tap the colors to build a guess · keyboard: 1 to 8, Backspace erases, Enter checks.
How to play Mastermind
The computer hides a code of 4 to 6 colors. Build a guess by tapping the colors on the palette (or using keys 1 to 8) and tap “Check”. You get 10 attempts with a 4-color code and 12 with a 5- or 6-color code.
Each guess gets a clue: one black peg for each correct color in the correct spot and one white peg for each correct color in the wrong spot. The clues do not say which positions are right, only how many. Use logic to eliminate possibilities with every row.
In “The computer cracks it” mode, you create the code and the computer tries to guess it using a Knuth-style strategy. After each guess, tell it how many black and white pegs it deserves. If you set the code on the screen, the game checks your answers and warns you if something is inconsistent.
Frequently asked questions
Is this the same as the Mastermind board game?
It is the same kind of code-breaking game with colored pegs. Mastermind is the name of a commercial version; here you play a free version with classic rules and several difficulty options.
In how many guesses can you crack the code?
With 4 pegs and 6 colors, the mathematician Donald Knuth showed that any code can be cracked in at most 5 guesses. The computer in this game uses a similar strategy and usually solves it in 4 or 5.
What changes when repeated colors are turned off?
Without repeats, each color appears at most once in the code, which reduces the possible combinations and makes the game easier. With repeats, a code can have, for example, two red pegs, and the clues are harder to interpret.