W Win Board Games
Home

Mastermind

Mastermind is an information theory game. Experts use Knuth's algorithm to minimize worst-case guesses and maximize information per guess.

Quick winning principles

  • Open with a guess using 2-3 colors (e.g. AABB) to maximize information, not all different colors.
  • Never repeat a guess that received zero black and zero white pegs.
  • Track eliminated colors and positions after each response.
  • Aim to eliminate 50%+ of remaining codes with each guess.

Ideal strategy

  1. 1

    Knuth's algorithm: after each guess, calculate remaining consistent codes. Choose the next guess that minimizes the maximum remaining set size (minimax).

  2. 2

    First guess optimization: AABB (two pairs) is optimal for 6 colors/4 pegs — it partitions the 1296 codes into balanced response groups.

  3. 3

    Information entropy: a guess that splits remaining codes into equal-sized groups maximizes expected information. Avoid guesses that leave one large group.

  4. 4

    Constraint narrowing: black pegs fix position; white pegs fix color but not position. Cross-reference both constraints before guessing.

  5. 5

    Endgame: with fewer than 10 codes remaining, guess a valid code directly rather than a probe — you might win immediately.

  6. 6

    Duplicate colors: remember codes can repeat colors (AAAA is valid). Don't eliminate color repetition too early.