Codebreaker Puzzle Generator
Guess a hidden sequence; each guess is scored by how many symbols are exactly right and how many are right but in the wrong place. The scoring rule is the interesting part, because it is easy to get wrong: exact matches must be counted and removed first, or a symbol that is both correct in one position and repeated elsewhere gets counted twice. This generates the code, states the search space, and demonstrates the rule with worked examples rather than describing it.
What this generator does
Generates a hidden code and scores two example guesses against it so the feedback rule is unambiguous. It also states how many codes are possible, which is the number that actually determines difficulty: six symbols in four positions with repeats is 1,296 possibilities, and without repeats only 360.
How to use this tool
- Choose the code length and how many symbols are in play.
- Decide whether the code may repeat a symbol.
- Generate, and read the worked examples to see how feedback is scored.
- Reveal the code when you are done, or seed it to share the same one.
Understanding the controls
- Code length
- Between 3 and 6 positions. Each extra position multiplies the search space by the symbol count.
- How many symbols
- Between 3 and 10. This matters more than length for how hard the code is to find.
- Allow repeated symbols
- Turning repeats off shrinks the search space substantially and changes the deduction — you can rule out a symbol entirely once you have placed it.
- Seed
- Reproduces the same hidden code, so two people can attempt the identical puzzle.
- Show the answer
- Reveals the code. The worked examples are scored against it either way.
Common use cases
- Playing a deduction game without a physical set
- Understanding the feedback rule before implementing it yourself
- Testing a solver against codes whose answer is known
- A quick logic challenge with an adjustable difficulty
- Generating the same code for two people to race on
How this generator works
Feedback is computed by counting exact positional matches first, removing those symbols from both the code and the guess, and only then counting how many of the remaining guess symbols appear somewhere in the remaining code. Each worked example is checked by re-scoring it, confirming the code scores perfectly against itself.
Randomness and fairness
Which code you get is random; the feedback rule is not. Seeded codes are reproducible and therefore explicitly not cryptographically secure — never use one of these as an actual secret. Without a seed the browser's cryptographically secure generator is used.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- This produces the code and the rule; it does not play the game with you or track your guesses.
- It offers no solver, so it cannot tell you the optimal next guess.
- Codes here are for puzzles. A seeded code is predictable by design and is not a security token — the site's password and PIN tools are the right thing for that.
- Nothing is retained between visits; seed a code you want to set for someone else.
Privacy and your data
The code is generated and scored entirely in your browser. Nothing you set or reveal is transmitted or stored between visits.
Related generators
- Logic Grid Puzzle GeneratorZebra-style puzzles where clues are sentences about who goes with what, every clue proved necessary and exactly one arrangement possible.
- Futoshiki GeneratorA Latin square solved from greater-than signs rather than given digits, with every clue proved necessary and exactly one answer.
- Number Sequence Puzzle GeneratorWhat comes next — sequences built from a rule rather than invented and explained afterwards, with the rule shown in full when you reveal.