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
  • Equation Guess

    Find the hidden eight-character equation in six tries.~3 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
  • Syllogisms

    Decide whether a conclusion really follows.~3-5 min
  • Logic Grid

    Work out who has what from the clues.~3-6 min
  • Word Guess

    Find the hidden five-letter word in six tries.~3 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 Code Breaker 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.

How do you read the clues?

Each guess gets two numbers: pegs of the right colour in the right place, then pegs of the right colour in the wrong place. Three deductions do most of the work:

  • 0 and 0: none of the colours in that guess is in the code at all. Cross them all out.
  • The two numbers add up to 4: you have every colour of the code, and only the order is left.
  • Change one peg at a time: if the first number goes up, the new peg is right where it is; if the total drops, the peg you removed was in the code.

What can affect your Code Breaker result?

Luck on the first guess or two, and then method. A first guess with two colours, such as two of one and two of another, tells you about two colours at once without wasting a place. After that, every guess should be one that could still be the code: a guess the clues have already ruled out can teach you something, but it can't win. The game isn't timed, so there's no cost to stopping and checking each clue.

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.