Code Breaker

Crack the secret colour code in 10 guesses — feedback pegs guide your logic. Three difficulties, timed scoring, ranked.

How to play Code Breaker

Code Breaker is a classic code-cracking deduction puzzle. The computer secretly chooses a code made of coloured dots, and your job is to work out the exact code — the right colours in the right order — within 10 guesses. After every guess you receive feedback pegs that tell you how close you were, and by combining the clues from all your rows like a detective you can zero in on the answer. It is pure logic: no luck, no time pressure on your thinking (though faster solves score more), and it works completely offline.

The goal

Deduce the computer’s hidden colour code before your 10 guesses run out. On Easy the code has 4 slots drawn from 6 colours with no colour repeated; on Medium it has 4 slots from 8 colours and the same colour MAY appear more than once; on Hard it has 5 slots from 8 colours, repeats allowed. The code is fixed when the round starts and never changes mid-game.

The board

The board shows one row per guess. Each row holds your guessed colour dots on the left and a cluster of small feedback pegs on the right. Below the board is the colour palette — every colour also carries a letter (R, O, Y, G, B, P, C, M) so the dots stay distinguishable for colour-blind players or on poor screens. A counter shows your remaining guesses and a timer shows your elapsed seconds.

Making a guess

  • Tap colours in the palette to fill the current row from left to right. On Easy, colours you have already used in the row are dimmed, because the secret never repeats a colour there.
  • Made a mistake? Tap any filled dot in the current row to clear it and everything after it, or use the ⌫ button to remove the last colour.
  • When every slot is filled, press Check. The guess is scored instantly and its feedback pegs appear at the end of the row.
  • Repeat, using all previous rows as evidence, until you either reproduce the exact code (you win) or use up all 10 guesses (you lose and the secret is revealed).

Reading the feedback pegs

Each guess earns two kinds of pegs. A SOLID peg means one of your dots is the right colour in the right position. A HOLLOW peg means one of your dots is a colour that exists in the code but sits in the wrong position. Pegs are NOT in slot order — they never tell you WHICH dot is right, only HOW MANY are.

With repeated colours the counting follows the standard “multiset” rule: each dot in the secret can be matched by at most one dot in your guess. First all exact position matches are paired off and counted as solid pegs; then, among the remaining dots, each colour contributes the SMALLER of (times it appears in the rest of the secret) and (times it appears in the rest of your guess) as hollow pegs. Example: if the secret is Red-Red-Blue-Blue and you guess Red-Blue-Red-Red, you get 1 solid peg (the first Red) and 2 hollow pegs (one extra Red and one Blue exist elsewhere) — your third Red earns nothing because the secret only has two Reds in total.

Winning, losing and scoring

You win the moment a guess matches the code exactly (all pegs solid). Your score is max(1, (11 − guesses used) × 900 − seconds elapsed): cracking the code in fewer guesses is worth far more than speed, but seconds are subtracted, so decisive play pays. The best possible score is 9000 (first guess, instantly); scores always fit within the leaderboard cap of 99,999. If you fail 10 guesses the secret code is revealed and nothing is submitted — losses never hurt your ranking.

Strategy tips

  • Open with a spread: a first guess of 3-4 different colours tells you immediately which colour families are in the code and which are not.
  • Use zero-peg rows aggressively — if a guess scores no pegs at all, EVERY colour in it is absent from the code and can be eliminated from all later thinking.
  • To separate “right colour” from “right place”, keep a suspected colour but move it to a different slot: a hollow peg turning solid pinpoints its true position.
  • On Medium and Hard, remember repeats: two hollow pegs for one colour can mean that colour appears twice. Testing a double (e.g. Red-Red-Green-Blue) is often the quickest way to confirm it.

Frequently asked questions

Do the feedback pegs correspond to my dot positions?

No. The peg cluster is a summary, not a map: pegs are shown solid-first regardless of which slots earned them. Three solid pegs mean “three of your dots are perfectly placed”, but you must deduce which three from the pattern of your other guesses.

How exactly is the score calculated?

Score = max(1, (11 − guessesUsed) × 900 − secondsElapsed), capped at 99,999. Win in 1 guess after 20 seconds → (11−1)×900−20 = 8980 points; win in 7 guesses after 90 seconds → (11−7)×900−90 = 3510. Only WINS are submitted to the leaderboard, tracked separately per difficulty, and your best score counts.

I have trouble telling the colours apart — is there help?

Yes. Every colour dot carries a fixed letter — R (red), O (orange), Y (yellow), G (green), B (blue), P (purple), C (cyan), M (magenta) — in the palette, in your guesses and in the revealed code, so the game is fully playable by letter alone.

Does Code Breaker work offline?

Yes. Once loaded, the puzzle generator and checker run entirely in your browser. Scores earned offline are stored on your device and uploaded automatically the next time you are online and signed in.