Free logic puzzle — instant play, no signup, no download
Codebreaker is the Bulls and Cows deduction game — known commercially as Mastermind. A secret number code is generated, you guess, and each guess is scored: how many digits are right and in the right place, and how many are right but misplaced. Nothing is hidden from you except the code itself, so every wrong guess is information.
Choose a difficulty — code length and whether digits can repeat.
Enter a guess at the secret code.
Read the feedback: exact matches in the right position, plus correct digits in the wrong position.
Use that to eliminate possibilities and guess again.
Crack the code before you run out of attempts.
Easy is 3 digits from 1–6 with 15 guesses; medium 4 digits from 1–8 with 12; hard 5 digits from 1–9 with 10; extreme 6 digits from 1–9 with 8. You can require all digits to be different, and you get up to two hints, each revealing one position you have not yet got right.
Crack the code and you are rated by how much of your guess allowance you used: 30% or less is 'Mastermind', 50% or less 'Brilliant', 70% or less 'Great'. XP is 15 for every guess you had left, plus 15 (minimum 10). Your fewest-guesses win and win streak are saved in this browser.
Systematic deduction and hypothesis elimination — narrowing a space of possibilities using partial information. This is genuinely the same reasoning pattern as debugging, medical differential diagnosis and any 'twenty questions' problem. More logic games to try next: Safe Cracker and Suguru.
Codebreaker is Bulls and Cows, the pencil-and-paper game that inspired the board game Mastermind. After each guess you learn how many digits are right and in the right place (bulls) and how many are right but misplaced (cows).
It is a well-studied problem in computer science: Donald Knuth showed in 1976 that any code in the standard Mastermind set-up can be broken in five guesses or fewer. For people the skill is hypothesis testing — choosing a guess that splits the remaining possibilities, rather than one that could be right.
Open with a guess that uses distinct digits. Repeats tell you less on the first move.
Change only one digit between guesses when you are close. Changing two makes the feedback ambiguous.
Write down which digits are fully ruled out. Almost every failed run is caused by re-guessing a digit you already eliminated.
A result of zero and zero is the most valuable feedback in the game — it eliminates every digit you used at once.
Yes, the same logic with digits rather than coloured pegs. The Bulls and Cows version predates the commercial board game.
That depends on the mode you choose. Unique-digit mode is considerably easier because it lets you eliminate faster.
With optimal play a standard four-digit code can be cracked in a handful of guesses. Getting near that consistently is the real challenge.
At the very start, yes. After two informative guesses, pure deduction should carry you the rest of the way.