Skip to content
ReactionTimeMS
— Hz
Number deduction

Crack the Code – Find the Secret Code

Ready

Standby

Standby

Crack the Code – Find the Secret Code

Work out the hidden code from the clues you get after each guess. Some digits may be right and already in place, while others may belong in a different position. The clues tell you something about the whole guess, so your next move depends on what earlier guesses ruled out.

Quick verdict

Cognition

Work out the hidden code from the clues you get after each guess. Some digits may be right and already in place, while others may belong in a different position. The clues tell you something about the whole guess, so your next move depends on what earlier guesses ruled out.

A well-chosen guess can confirm the code or eliminate several alternatives. Keep the count of exact matches separate from the count of correct digits in the wrong place.

§1

Crack the code in a three-digit puzzle

The secret is visible in this explanation so you can verify the counts. During a real round, a single exact match could refer to any position in the guess. Combine feedback from several rows before assigning a digit to a fixed slot.

Worked example with secret code 582 and three distinct digits
GuessRight digit and placeRight digit, wrong placeWhat the example shows
50910The 5 is exact. Neither 0 nor 9 belongs.
25803All three digits belong and every position needs to change.
52812The first position is exact and the last two are swapped.
58230All three digits are in place.
§2

What each clue shows about the secret code

The two counts together tell you how many digits match. If the feedback on a three-digit guess is one exact and two misplaced, every digit is represented somewhere. At that point, work on the arrangement. If there are two total matches, one place still needs a different digit unless the puzzle uses a special repeat rule.

A zero can be particularly informative. Zero total matches lets you eliminate all digits from that guess in a distinct-digit puzzle. Zero exact matches with some misplaced means that at least one digit belongs somewhere else. Those two situations call for very different next guesses.

If a guess contains three competing digits and the clue shows zero matches, cross out all three. If all three are present but misplaced, keep the digits and test a new order. Both clues reduce the problem, but they rule out different things.

§3

What to do when your guesses stall

Every digit belongs

Compare the possible orders against every clue you already have.

If 258 told you that all three digits belong but none is in place, only arrangements that move 2, 5, and 8 all qualify. An earlier guess with 5 first and one exact can then distinguish two otherwise plausible orders.

You keep recycling wrong digits

Separate eliminated digits from digits with unknown positions.

Write a compact record when playing for practice. Reusing a digit with zero total matches is a conscious choice only when it supports a test of another position. Otherwise it costs a space you could use to learn something new.

§4

A problem-solving routine for finding the right spot

  1. Check whether the puzzle allows duplicate digits. If it does, read how partial matches are counted before using a rule meant for distinct digits.
  2. Pick one uncertainty and design a guess around it. You might swap two confirmed digits or replace two unconfirmed digits with digits you have yet to test.
  3. Read the new clue beside the earlier clues. Keep a candidate only if you could get every exact and misplaced count with that candidate as the secret.
  4. When one candidate fits all the feedback, enter it. In an open-ended practice puzzle, explain which pair of clues eliminated the last alternative.
§5

Why a compact record helps

Deduction becomes harder when you carry old guesses, counts, and candidate positions in your head at once. Miller’s discussion of recoding helps explain why one compact record of a clue can be easier to retrieve than several loose digits. In this puzzle, a written record also makes it possible to verify a candidate against evidence you collected much earlier.

For a practice round, try keeping only two lists. One holds possible codes. The other holds guesses and their feedback. After every move, score each candidate against the newest guess as if it were the secret, then cross out any candidate whose counts disagree. This procedure still works when a clue is hard to interpret on its own.

Frequently asked questions

What does it mean to crack the code?

In this game, it means identifying the exact secret digit sequence from the feedback on your guesses. A guess that contains the right digits in a different order gives useful information and leaves the puzzle open.

How do you play a three-digit crack the code game?

Enter a three-digit guess, then read the counts for digits in the right place and digits that belong elsewhere. Use those counts to test your next guess and continue until the whole sequence matches.

Can a puzzle have two solutions?

The clues you have so far can fit several possible codes. Design a guess that would receive different feedback under the remaining candidates, so the next clue can distinguish them.

What happens if a digit appears twice?

Check the puzzle’s repeat rule. A common convention pairs exact matches first and then matches each remaining occurrence at most once. A single occurrence in the secret cannot satisfy two copies in the guess under that convention.

Is Crack the Code like Mastermind?

Both use feedback to narrow a hidden sequence. In this number puzzle you compare digits in the right spot with digits that belong somewhere else. Work from the totals rather than treating the result as a mark on each digit.

Scientific references

  1. Miller (1956) · Psychological Review
    Context on recoding information into chunks. The article does not set code-breaking puzzle rules or scores.