Logic Puzzles

Code Detective

A detective reads a muddy footprint and a broken twig as clues. Here the clues are old guesses at a secret code, each with a few marks beside it. Even a guess with no marks at all says a lot.

Free sets by level, ages 6–12:

Code Detective, Level 2: three puzzles, each two marked guesses of 3 shapes, a tracking grid and 3 empty boxes for the secret code.Level 2: a page from the free set

Before starting

  • Level 2: match shapes; no reading needed
  • Know what "same place" and "different place" mean in a row
  • Levels 3–4: keep track of several clues at once

Free puzzles to print

Each set: a Learn sheet with a worked example, 10 puzzles from easiest to hardest, and the answers.

  • Level 2

    Ages 6–8 · Grades 1–2

    Code Detective, Level 2: three puzzles, each two marked guesses of 3 shapes, a tracking grid and 3 empty boxes for the secret code.

    A 3-symbol code from 5 or 6 shapes, no shape used twice. The easiest puzzles include a guess with no marks; next, a symbol must be moved to a new place; the hardest mix checks and arrows in one guess.

    On the sheet: “Check mark: right symbol, right place. Arrows: right symbol, wrong place.”

    Print Level 2 (Letter)Other paper size: A4
  • Level 3

    Ages 8–10 · Grades 3–4

    Code Detective, Level 3: two puzzles, each four marked guesses of 4 shapes, a tracking grid and 4 empty boxes for the secret code.

    4 places and 6 shapes, then two guesses that must be read together. Then digits 0 to 9 with more guesses; the hardest puzzles have 5 places and digits 1 to 7.

    On the sheet: “Check mark: right symbol, right place. Arrows: right symbol, wrong place.”

    Print Level 3 (Letter)Other paper size: A4
  • Level 4

    Ages 10–12 · Grades 5–6

    Code Detective, Level 4: two puzzles, each five marked guesses of 4 shapes, some shapes used twice, and 4 empty boxes for the code.

    4 places, and a shape may be used more than once. Fewer guesses, then one "what if" test. The very hardest puzzles ask which of three next guesses would surely reveal the code.

    On the sheet: “Check mark: right symbol, right place. Arrows: right symbol, wrong place.”

    Print Level 4 (Letter)Other paper size: A4

How it works

Someone has made a secret code of shapes or digits. The sheet shows earlier guesses at it. Each guess has marks: a check for every symbol in the right place, and arrows for every symbol that is in the code but in the wrong place. A dash means none of that guess's symbols is in the code. The marks don't say which symbol they belong to. The child reads the guesses together and works out the secret code, using a small grid to cross off what can't go where.

How to play

  1. Find any guess with a dash. Cross out all its symbols in the grid.
  2. Look at a guess with arrows and no check mark: some of its symbols are in the code, but none is in the place where it sits.
  3. Compare two guesses that share symbols. What changed, and how did the marks change?
  4. Write the code, then check it against every guess: it must earn the same marks.

When it gets hard

  • Thinking each mark sits under its own symbol.

    Hint: The marks are a count for the whole guess. They don't say which symbol is right.

  • Forgetting that a guess with arrows and no check mark also says "not in these places".

    Hint: None of that guess's symbols is in the place where it was guessed. Cross those out, then look for where they can go.

  • Not checking the final code against every guess.

    Hint: Mark each old guess against your code. The marks must match exactly.

Tip for grown-ups: Play it out loud first: pick a 3-shape code and let your child guess, giving checks and arrows. After a few rounds the printed puzzles make sense.

Frequently asked questions

Does my child have to guess?
No. The guesses are already on the sheet, with their marks. Your child reads the marks like a detective and works out the code from them. No luck is needed.
Why don't the marks line up under the symbols?
On purpose. The marks count how many symbols are right, not which ones. Working out which ones is the puzzle.

Questions about printing, levels, answers or membership: see all questions.

Code Detective, Level 2 Learn sheet with a worked example

Worked example

From the Level 2 Learn sheet

  1. A check mark means right symbol in the right place.
  2. Arrows mean right symbol, but in a wrong place.
  3. A dash means none of those symbols is in the code.

A question to ask: “Ask: which guess tells you what is NOT in the code?”

Free every Sunday A mixed bag of 20 new puzzles, all four levels. Get them by email

The thinking it works on

  • Reading what the marks prove

    Turns marks on old guesses into facts about the code.

    Gierasimczuk, van der Maas and Raijmakers (2013) studied more than 37,000 children aged 5 to 12 solving guess-and-marks code puzzles online. A puzzle's difficulty was well predicted by the number of reasoning steps needed to pin down the code. Source

  • Reasoning by elimination

    Rules symbols out of the code or out of a place.

  • Combining two clues

    Compares two guesses to see what one change did to the marks.

    Johnson-Laird, Oakhill and Bull (1986) asked 9- to 10- and 11- to 12-year-olds to draw conclusions from pairs of statements. The more possible situations the two statements left open, the harder the children found it to reach the right conclusion. Source

  • Keeping careful records

    Uses the symbol-by-place grid so nothing is forgotten.

    Eskritt and Lee (2002) let children in grades 1, 3, 5 and 7 make notes while playing a memory card game. First and third graders' notes were mostly no help. Fifth and seventh graders wrote notes that worked and leaned on them to keep track of where the cards were. Source

  • Testing a "what if"

    Supposes one symbol and follows it until it fits or clashes.

    Markovits and Vachon (1989) found that 10-year-olds, and to a lesser extent 13-year-olds, had trouble reasoning from an if-then statement known to be false. Fifteen-year-olds did not. Source

  • Planning the best question

    Picks the next guess that would settle the code.

    Ruggeri and Lombrozo (2015) found that 7- to 8-year-olds mostly asked questions that test one guess at a time. Nine- to 11-year-olds more often asked questions that rule out several options at once. All ages shifted to the second kind when the problem was harder. Source

Where is this thinking used?

  • Fixing things: Changing one thing at a time and watching what happens.
  • Science: Reading results to rule ideas out.
  • Twenty questions: Choosing the question that splits the options best.
  • Combination locks: Each wheel is a place, and each place holds one symbol.

For teachers

Curriculum areas
Common Core
No direct curricular match.

Math practices: see the box below.

Math practices this puzzle uses

  • Uses: MP1 Make sense of problems and persevere in solving them
  • Not used: MP2 Reason abstractly and quantitatively
  • Uses: MP3 Construct viable arguments and critique the reasoning of others
  • Not used: MP4 Model with mathematics
  • Not used: MP5 Use appropriate tools strategically
  • Not used: MP6 Attend to precision
  • Not used: MP7 Look for and make use of structure
  • Not used: MP8 Look for and express regularity in repeated reasoning

From the Common Core Standards for Mathematical Practice.

More Code Detective puzzles for members

Members get at least 5 more worksheets at each difficulty for every puzzle, 80 new puzzles every Sunday, and the whole archive. $39 a year or $25 for 6 months.

See membership

Not ready yet?

Try these next

More logic puzzles

New here? Start here

Also known as: code-breaking game, bulls and cows, guess-the-code puzzles, deduction code puzzles.