Skip to content
One Quick Try

Code Breaker Game

Crack a hidden code of 4 colours. Each guess tells you how close you are.

Type
Logic
Takes
about 2-5 min
Result in
guesses

Code Breaker

~2-5 min

  1. A hidden code of 4 colours, chosen from 6. A colour can appear more than once.
  2. Build a guess from the palette and check it. You learn how many are right in colour and place, and how many more are the right colour in the wrong place.
  3. Crack it in 10 guesses or fewer.

Each colour has a letter, so you can play without telling colours apart.

Your result: — guesses

How it's measured
  • Make 24

    Use all four numbers to make 24.~2-4 min
  • Shape Equations

    Each shape is a number. Work them out.~2-4 min
  • Matrix Reasoning

    Find the picture that completes the grid.~3-5 min
  • River Crossing

    Get everyone across the river safely.~2-5 min
  • Water Jug

    Measure an exact amount with unmarked jugs.~1-4 min
  • Pattern Trio

    Find three cards that match or all differ.~2 min

How do you play the code breaker game?

A code of 4 colours is hidden, chosen from 6, and a colour can appear more than once. Build a guess by tapping colours from the palette, then press Check. Two numbers come back: how many pegs are the right colour in the right place, and how many more are the right colour but in the wrong place. Use the clues to narrow it down and crack the code within 10 guesses. Every colour also has a letter, so the game never depends on telling colours apart.

How is your result calculated?

Your result is how many guesses you needed, with your time. If 10 guesses run out, the code is shown and the game counts as not cracked.

How many guesses should it take?

There are 1,296 possible codes (6 colours in each of 4 places). In 1977 Donald Knuth showed that any of them can be found in at most five guesses, by choosing each guess to keep the worst case as small as possible. So five or fewer means playing as well as that computer strategy.

The game is the scoring of Mastermind, the board game invented by Mordecai Meirowitz in 1970, and it resembles an older pencil-and-paper game called bulls and cows.

How do you crack the code faster?

  • Open with two pairs. A first guess of two colours, two pegs each, is the start of Knuth's strategy. It tells you about two colours at once without spreading the clues too thin.
  • Make every guess possible. Before you check a guess, make sure it fits every clue so far. A guess that can't be the answer wastes a turn unless you are deliberately testing something.
  • Change one thing to learn one thing. Swapping two pegs between guesses tells you which of them was in the right place.

For another puzzle of pure deduction, try the Shape Equation Puzzle; for numbers instead of colours, Make 24.

Questions

What do the two clue numbers mean?
The first counts pegs that are the right colour in the right place. The second counts pegs that are the right colour but in the wrong place. A peg is never counted twice.
Can a colour appear more than once in the code?
Yes. Repeats are allowed, as in the board game, so a code could be four of the same colour.
What is the best first guess?
Two colours, two pegs each, such as red, red, orange, orange. It is the opening of Donald Knuth's strategy, which never needs more than five guesses.
Is this Mastermind?
It uses the same rules and scoring as Mastermind, the 1970 board game: four pegs, six colours, clues for right place and right colour.
How many possible codes are there?
1,296: each of the 4 places can hold any of 6 colours.