Puzzle · Logic

Mastermind

Crack the secret 4-color code using logic and black/white peg feedback in 10 guesses.

Overview

Every guess returns a row of black and white pegs, and that thin trickle of feedback is all you have to break a hidden four-color code. Mastermind is a code-breaking puzzle: the secret is four slots drawn from six colors, colors may repeat, and you have ten rows on the board to deduce it. After each guess, black pegs mark slots that are correct in both color and position, and white pegs mark colors that exist in the code but in the wrong slot — the feedback never tells you which peg is which, only the counts. That ambiguity is where the difficulty lives, because a single white peg could point to any of three positions. The board keeps your full guess history visible so you can cross-reference, and a best-score tracker records the fewest guesses in which you have ever cracked a code. Lose all ten rows and the solution reveals itself, which turns a missed game into a lesson rather than a dead end.

How to Play

Click a color from the palette, then click a slot to place it; click an occupied slot again to remove a peg. On touch, tap a color and then tap a slot. Submit a full row of four pegs to receive your black and white peg feedback for that guess, then move to the next row. You have ten rows in total to find the four-slot code. Remember that colors may repeat — a code of four identical colors is legal, and the feedback rules treat each peg individually. Run out of rows and the solution is revealed at the bottom of the board.

Tips & Strategy

Make your first guess information-dense rather than a stab at the answer. A common opening uses two of one color and two of another (say, red-red-blue-blue), which on a six-color palette tells you roughly how often the common candidates appear. From the feedback, prune the possibility space: if a color produced zero pegs of either kind, drop it from every future guess, because it is not in the code at all. When peg counts climb, start pinning colors to positions — guess the same color in two different slots across consecutive rows and watch how the black-peg count moves. Always account for repeats: a four-peg feedback can mean four distinct colors or a repeated one, and misreading that is the fastest way to waste a row. Treat each guess as a question about the code, not a guess at the code, and by row six or seven the space will have narrowed to a handful of candidates. The best-score counter rewards finishing early, so once you are certain, commit rather than hedging.

Controls

Keyboard
Click color pegs to place
Mouse
Click to place and remove pegs
Touch
Tap to select and place pegs

Features

  • 4-slot code, 6 colors
  • 10 guess board
  • Black/white peg feedback
  • Colors may repeat
  • Best-score persistence
  • Solution reveal on loss