🔐 How to play Mastermind (Secret Code)

By Miguel Arechaga

Mastermind is a game of pure deduction: the computer hides a color code and you have to uncover it by reading the clues from each guess. You don't need luck if you know how to read the black and white pegs correctly. Here are the rules and a method to lower your number of tries.

What is Mastermind?

The computer generates a secret code of 4 colors, which can repeat. Your goal is to guess it in a maximum of 10 tries. After each guess, the game gives you clues about how many colors you got right and in which position.

How to play

  1. Tap a color from the palette to place it in the first open slot of your current row. Tap a peg that's already placed to erase it.
  2. Once you've filled all 4 pegs, press Check.
  3. You'll get clues: a black peg ⚫ means correct color and position; a white peg ⚪ means correct color but wrong position.
  4. Use those clues to adjust your next guess. You have 10 tries total to crack the code.

The method: colors first, then positions

The typical beginner mistake is trying to nail positions from the very first guess. It's far more effective to split the problem into two phases:

  1. Find out which colors appear. Use your first two or three guesses with combinations that test different colors (for example, repeating the same color across all 4 pegs of a guess) to learn how many times each one appears in the code, without worrying about order yet.
  2. Fine-tune the positions. Once you know which colors make up the code, spend your remaining guesses swapping their order, watching how the number of black pegs changes compared to your previous guess: if it goes up, you're heading the right way.

Keep mental track (or jot down) which combinations you've already tried and what clues they gave you: every guess rules out possibilities, and not repeating information you already know is the difference between solving it in 5 tries or 9.

Quick tips

With this two-phase approach, you'll notice you go from throwing out nearly random guesses to solving the code methodically.

🏆 Best-run ranking

Mastermind has its own global ranking: it saves your best run, with the fewest tries used to crack the code. Go to Ranking, the 🕹️ 1 Player tab, choose "Mastermind" from the dropdown, and compare your score with other players, synced to your account. For your result to count you need a free account on MundoSudoku (just a username and password, no email required): you can play without one, but without logging in your score won't be saved to the ranking.

Ready to play?
Put what you've learned into practice.
🎮 Play Mastermind for free 🕹️ See all games
Miguel Arechaga, creator of MundoSudoku

Written by Miguel Arechaga

Creator and developer of MundoSudoku. Passionate about logic puzzles, he shares guides and tips so you can enjoy and improve at every game.