Mastermind
Crack the secret 4-peg color code in 10 rows or fewer.
Pick a color, then click the slots to build your guess.
Colors can repeat in the secret code. Feedback pegs are not tied to positions.
About Mastermind
Mastermind is the classic code-breaking board game, first sold in 1970 and built on a much older pencil-and-paper game called Bulls and Cows. The computer hides a secret code of four pegs drawn from six colours — red, blue, green, yellow, purple and orange — and colours are allowed to repeat, so a code like green-green-orange-green is perfectly possible. That single rule is what makes the game deep: with repeats allowed there are 1,296 possible codes, and pure guessing will not get you far.
What you get back after each guess is deliberately incomplete information. A black peg tells you one of your pegs is exactly right — the correct colour in the correct slot — while a white peg tells you one peg is a colour the code uses, but sitting in the wrong slot. The feedback pegs never say which of your four pegs they refer to, so the real game is pure deduction: combining the black and white counts from several rows to narrow 1,296 possibilities down to one. You have ten rows to do it in, which is comfortable for a careful player and brutally short for a careless one.
There is no timer and no points table — your score is simply how few guesses you need. Cracking the code in five or six rows is a strong game; the code is revealed at the end either way, so a loss still teaches you exactly where your logic went wrong.
How to Play Mastermind
Press New Game and the computer secretly generates a code of four pegs from the six colours, with repeats allowed. The code stays hidden behind question marks until the game ends.
Click a colour in the palette to select it, then click the slots in the active row to place your pegs. Click a filled slot again with a different colour selected if you want to change it.
Fill all four slots and press Check. Your guess is locked in and scored with feedback pegs: black for right colour in the right position, white for right colour in the wrong position.
Read the feedback as totals, not positions — the pegs do not tell you which slot earned them. Combine the counts across rows to work out which colours the code contains and where they can and cannot sit.
Build your next guess on what you have learned, changing as little as possible so each row tests a clear hypothesis.
Crack all four pegs — four black pegs — within ten rows to win. If the rows run out, the secret code is revealed above the board.
Controls
Tips & Tricks
- 💡Open with two pairs — for example red-red-blue-blue. One guess samples four slots and two colours at once, and the combined black and white total tells you exactly how many of those two colours are in the code.
- 💡Keep count of colour totals separately from positions. Once you know the code's exact colour mix, the endgame becomes a small permutation puzzle instead of a guessing game.
- 💡Change one thing at a time between guesses. If you reshuffle everything, the new feedback cannot be compared with the old rows and you learn almost nothing.
- 💡Use a colour you have already eliminated as filler. When testing where one known colour belongs, pad the other slots with a dead colour so the feedback can only be about the peg you are testing.
Mastermind — Frequently Asked Questions
Can the secret code repeat a colour?+
Yes. Each of the four pegs is drawn independently from the six colours, so doubles, triples and even four of a kind are all possible. Any strategy that assumes four different colours will eventually fail.
Why don't the black and white pegs line up with my slots?+
That is the core rule of Mastermind. The feedback pegs only report how many black and how many white results your guess earned — never which peg earned which. Deducing the mapping from several rows is the whole game.
How many guesses should a good player need?+
Most codes fall in five to seven careful guesses. Game theorists have shown every code can be cracked in at most five guesses with optimal play, so the ten-row limit is generous if your logic is tight — and unforgiving if you guess at random.
Does Mastermind work on mobile?+
Yes. The palette, slots and Check button are all tap targets, and there is no keyboard input or timer, so it plays comfortably on a phone or tablet.
More Games Like This
Browse all 2D games →Minesweeper
Clear the minefield without detonating any mines!
Sudoku
Fill the 9×9 grid so every row, column, and box has 1-9.
Lights Out
Press lights to toggle them and their neighbours — turn the whole grid off.
Nonogram
Solve picross logic puzzles from 5x5 to 15x15. Use the number clues to fill cells and reveal coloured pictures, with fill/mark modes and mistake checking.
All games on Vimzify are free to play in your browser — no downloads, no sign-up. Game page: https://vimzify.com/games/mastermind