Code Breaker
Crack the secret colour code with clues after every guess.
How to play Code Breaker
Code Breaker is a classic game of logic and deduction, based on the old pencil-and-paper game Bulls and Cows. A secret code of coloured pegs is hidden under the shield at the top. Every colour also has its own shape, so you can play without telling colours apart.
Goal
Find the exact code, every colour in the right place, in as few guesses as you can and before you run out of rows.
Turn by turn
- Fill the glowing row with pegs. Tap a colour button, or press its number key, to place it in the selected hole. Tap a hole to select it.
- Press Check (or Enter). Small clue pegs appear next to your guess.
- A solid white dot means one peg is the right colour in the right place. A hollow ring means one peg is the right colour but in the wrong place. The clues do not tell you which pegs they belong to.
- Use the clues to make a better guess on the next row. Undo removes pegs from the row you are filling.
- Stuck? Hint fills the row with a guess that fits every clue so far and tells you how many codes are still possible.
Levels
Easy: 4 pegs, 6 colours, no colour used twice, 10 rows. Medium: 5 pegs, 7 colours, colours may repeat, 12 rows. Hard: 6 pegs, 8 colours, colours may repeat, 12 rows.
Computer guesses
Switch the mode to Computer guesses, set your own secret code and press Lock code. The computer then guesses, and the clues are worked out for it. It uses the minimax method made famous by Donald Knuth, which always cracks the Easy code within five guesses. Can you pick a code that makes it work hard?
End of the game
The game ends when the code is cracked or the last row is used. Want more logic? Try Sudoku.
Strategy tips
- Open with pairs. With repeats allowed, a first guess like two reds and two blues tells you a lot about two colours at once.
- Only play possible codes. Before you check, make sure your guess would give every earlier row exactly the clues it got.
- Change one thing at a time. Swapping just two pegs between guesses shows clearly which pegs earned the white dots.
- Count colours first, places second. Add up dots and rings to learn how many of each colour are in the code, then work out the order.
- No clue is still a clue. A row with no dots or rings rules out every colour in it at once.
Code Breaker FAQ
What do the white dots and rings mean?
A solid white dot is a peg of the right colour in the right place. A hollow ring is a right colour in the wrong place. Their order does not match the pegs.
Can a colour appear twice?
Not on Easy. On Medium and Hard the code may use a colour more than once, and so may your guesses.
How does the computer crack my code?
It keeps a list of every code that fits the clues, then picks the guess whose worst result leaves the fewest codes. This is Knuth's minimax method.
Is this the same as Mastermind?
Yes, the rules are the same as Mastermind and Bulls and Cows, with three sizes and a mode where the computer is the code breaker.