How to play · 5 minute read

How to play Code Breaker

Code Breaker is a guessing game where you try to find a hidden code of coloured pegs. After each guess, clues tell you how many colours are right and in the right place, and how many are right but in the wrong place. Use the clues to crack the code in as few guesses as you can.

Players1 playeragainst a hidden code
Length3 to 10 minutesper code
EquipmentColoured pegsusually 6 colours
Learn it in2 minuteslogic does the rest

Step by step

  1. A code is hidden

    A secret code of 4 coloured pegs is chosen, using up to 6 colours.

  2. Make a guess

    Choose 4 colours in a row as your guess.

  3. Read the clues

    A dark clue peg means one colour is right and in the right place. A light clue peg means one colour is right but in the wrong place.

  4. Clues are not in order

    The clue pegs do not tell you which of your pegs they refer to. Working that out is the puzzle.

  5. Guess again

    Use what you have learned to make a better guess.

  6. Crack the code

    You win when every clue peg is dark. You have 10 guesses, and there is no timer.

The full rules

What you need

Code Breaker is played with coloured pegs. There is a hidden code of 4 pegs, made from 6 possible colours. You also need a row of small clue pegs for each guess: dark ones and light ones.

On paper, you can play with coloured pencils, or with numbers instead of colours.

The aim

Work out the hidden code, colour by colour and position by position, using as few guesses as possible. Most games give you 10 guesses.

Making a guess

Choose 4 colours and place them in order, from left to right. This is your guess. Then check it to receive your clues.

Reading the clues

After each guess, you get up to 4 clue pegs:

  • A dark peg means one of your pegs is the right colour and in the right place.
  • A light peg means one of your pegs is the right colour but in the wrong place.
  • No peg for a colour means it is not in the code at all, or not as many times as you guessed.

The clue pegs are not placed in any order. A dark peg on the left does not mean your left-hand guess was right. Working out which peg the clue refers to is the heart of the game.

An example

Suppose the hidden code is red, blue, green, yellow and you guess red, green, white, white.

  • Red is in the right place: one dark peg.
  • Green is in the code but in the wrong place: one light peg.
  • White is not in the code: no pegs.

So your clue is one dark peg and one light peg.

Levels

Level Pegs in the code Colours Repeated colours
Easy 4 6 No: each colour at most once
Normal 4 6 Yes
Hard 5 8 Yes

Every level gives you 10 guesses. Each colour also has its own shape (such as a circle, triangle or star), so you can tell the pegs apart without relying on colour alone.

Repeated colours

In many versions, a colour can appear more than once in the code. Each peg in the code earns at most one clue. If the code has one blue and you guess two blues, you will get only one clue peg for blue.

Winning

You win when your guess earns four dark pegs. If you use up all your guesses, the code is revealed and you can try again.

Common variants

  • Bulls and Cows uses a secret number of 4 different digits. A bull is a right digit in the right place, and a cow is a right digit in the wrong place.
  • Harder versions use 5 or 6 pegs, or 8 colours.
  • Word games ask you to guess a hidden word, with letters marked in a similar way.

Tips for beginners

  • Start with two colours. A guess like red, red, blue, blue tells you clearly about two colours at once.
  • Change one thing at a time. If you change just one peg, any change in the clues tells you about that peg.
  • Keep track of each colour. Note which colours are definitely in, definitely out, or unknown.
  • Check every clue. Before each guess, make sure it fits all the clues you have had so far.
  • Do not waste guesses. A guess that cannot possibly be right still costs a turn, so make each one count.

Common questions

Can a colour appear more than once in the code?

On Normal and Hard, yes: a code such as red, red, blue, green is allowed. On Easy each colour is used at most once, in the code and in your guesses.

How are clues given when a colour is repeated?

Each peg in the code can only earn one clue. If the code has one red and you guess two reds, you will get at most one clue peg for red.

What is Bulls and Cows?

Bulls and Cows is an older pencil-and-paper version played with numbers. A bull is a right digit in the right place and a cow is a right digit in the wrong place.

How many guesses does it take?

With 4 pegs and 6 colours, every code can be solved in five guesses or fewer with perfect play. Most people take five to seven.

What is a good first guess?

Many players start with two colours, such as red, red, blue, blue. It tests two colours at once and makes the clues easier to read.

Where it comes from

Code-guessing games have a long history. Bulls and Cows, played with numbers on paper, is thought to be at least a century old. A board-game version using coloured pegs became very popular in the 1970s, and the idea has been adapted many times since, including word-guessing puzzles.