Code Breaker

Carregando… / Loading…

Code Breaker

Crack the secret code using right-place and wrong-place clues

See details
  • Runs in your browser
  • No signup
  • Games
  • Updated on
About this game

Crack the secret code with logic and deduction

Code Breaker is a classic deduction game: a secret code of 4 to 6 colored pegs stays hidden and you have a limited number of guesses to crack it. After every guess the game answers with clues: a solid peg for each right color in the right place and a hollow ring for each right color in the wrong place. With repeats allowed, each peg of the code can earn only one clue, so a guess with three identical pegs does not count a color three times if the secret has it once. You can play against a code picked by the computer, pass the device to a friend who makes the code (scoring follows the traditional rule: the code maker earns one point per guess the opponent uses, plus one if the code is not cracked, and whoever has more points after swapping roles wins), or let the computer try to guess yours. In that mode it uses Donald Knuth's 1976 five-guess algorithm: with 4 pegs, 6 colors and repeats, it cracks any of the 1,296 possible codes in at most 5 guesses. There is also a digits version known as Bulls and Cows, where the code has all-different digits. The colors follow the Okabe and Ito palette, designed for color blindness, and every color also has its own shape inside the peg.

How to play

Build a guess and read the clues

  1. Tap colors to fill the guess row (or drag a color to a position, or use the 1 to 8 keys) and submit.
  2. Read the clues: a solid peg is the right color in the right place, a ring is the right color in the wrong place. The clues don't say which pegs scored.
  3. Use the clues to rule out possibilities and crack the code before you run out of guesses. Stuck? Ask for a hint.
References

Sources and references for this tool

These references help contextualize formulas, standards, APIs and limitations used on this page. They do not replace professional validation when a result has legal, financial, medical or operational impact.

FAQ

Frequently asked questions

Each peg of the code can produce only one clue. First the pegs in the right place (solid) are counted. Then, for each color, the number of rings is the smaller of how many times it appears in the guess and in the code, minus the solid pegs of that color. So with code 1-1-2-2 and guess 1-1-1-2, you get three solid pegs and no rings.

Games