About Mastermind - history, rules and strategy
Mastermind is a code-breaking game for two players in which logic and careful deduction beat lucky guessing.
Where it comes from
Mastermind was invented in 1970 by Mordecai Meirowitz and became a worldwide hit in the 1970s. It is based on the older pencil and paper game Bulls and Cows, which is played with numbers.
The rules
One player sets a secret code of coloured pegs. The other tries to find it. After each guess the codemaker places black pegs for exact matches and white pegs for right colours in the wrong place.
Strategy
A good guess is one that splits the remaining possible codes into many small groups. In 1977 Donald Knuth showed that the classic 4 peg, 6 colour game can always be solved in five guesses or fewer.
Frequently asked questions
How many possible codes are there?
With 4 pegs and 6 colours there are 1296 codes when colours may repeat. With 6 pegs and 8 colours there are over 260,000.
Is it better to allow repeated colours?
Repeats make the game harder because there are more possible codes and the feedback is harder to read.
What is a good first guess?
With repeated colours, a guess of two pairs such as red, red, blue, blue is a strong start for the classic game.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Play Mastermind