Crack the Code

I've set my code. Crack it if you can.
Pick a colour to start!
🎉
Code Cracked!
The secret code was
EASY MODE
4 colours · No duplicates · Easiest to solve

Easy: 4 colours, no duplicates
Classic: 6 colours, duplicates allowed
Hard: 8 colours, duplicates allowed

Black = right colour, right position
White = right colour, wrong position
All difficulties use 4 pegs and 10 guesses

Crack the Code: Quick Guide and Game Info

Can you crack Prof. Marty’s secret code before you run out of guesses?

Crack the Code is a deduction game where you have 10 attempts to uncover a hidden sequence of four colours. After every guess, you’ll receive feedback showing how close you’ve come, but you’ll have to work out for yourself which colours the clues refer to. Choose between Easy, Classic and Hard, then use logic, elimination and a little patience to break Marty’s code.

The rules are simple to learn. Figuring out what your previous guesses are really telling you is where things get interesting.

About Our Crack the Code Game

Prof. Marty secretly chooses a sequence of four coloured pegs. Your job is to determine all four colours and put them in exactly the right positions within 10 guesses. There are three difficulty levels:

  • Easy: 4 colours, no duplicates
  • Classic: 6 colours, duplicates allowed
  • Hard: 8 colours, duplicates allowed


The length of the secret code always remains four pegs. What changes is the number of possible colours and whether Marty can use the same colour more than once. After each completed guess, you’ll receive black and white feedback pegs that tell you how accurate your attempt was.

Keep narrowing down the possibilities until you either crack the complete code or use your tenth and final guess.

Game Layout and Setup

Start by choosing your difficulty: Easy, Classic or Hard.

Prof. Marty then creates a secret code consisting of four coloured pegs. The colours he can use, and whether duplicates are possible, depend on the difficulty you’ve selected. Your game board gives you 10 rows for 10 guesses.

For each attempt, choose colours from the available palette to fill all four positions in your current row. Once your guess is complete, check it to see Marty’s feedback. Your completed guesses remain visible on the board, along with their black and white feedback pegs, so you can compare new clues with everything you’ve already learned. A black peg represents a correct colour in the correct position, while a white peg represents a correct colour in the wrong position.

The secret code stays hidden while you play. Crack all four positions before your 10 guesses run out to win.

How to Play Crack the Code

Start by choosing Easy, Classic or Hard. Prof. Marty will create his secret four-peg code using the colours available on your selected difficulty.

Select colours to start the game. If you want to change any of the colours before checking just click the colour you want to change and choose another one. The erase button will erase the last colour in the row. Once all four positions are filled, submit it and examine the feedback.

A black feedback peg means you’ve guessed one correct colour in exactly the correct position. A white feedback peg means you’ve guessed a colour that belongs in the code, but you’ve placed it in the wrong position. No feedback for a colour means it hasn’t contributed a match.

Use what you’ve learned to make your next guess. You have 10 attempts to identify the exact sequence. Get all four colours into their correct positions and Marty’s code is cracked. Fail to solve it within 10 guesses and Marty gets to keep his secret. He’s probably going to be far too pleased about that.

Understanding the Black and White Pegs

The feedback pegs are the most important part of the game. Suppose the secret code was:

Red – Blue – Green – Yellow

and you guessed:

Red – Green – Purple – Yellow

You would receive:

2 black pegs — Red and Yellow are both the correct colours in the correct positions.

1 white peg — Green belongs in the code, but you’ve placed it in the wrong position.

Purple doesn’t match anything in the secret code, so it produces no feedback. There’s one important catch. The feedback pegs don’t tell you which individual colours they belong to. If you receive two black pegs and one white peg, you know that three parts of your guess have contributed matches, but the feedback itself doesn’t point at the corresponding positions.

Working out which colours produced those clues is up to you. That’s where the deduction begins.

Easy, Classic and Hard

Easy uses 4 possible colours to create a four-peg secret code, and duplicate colours are not allowed. That means each available colour can appear at most once in Marty’s code. This makes elimination considerably simpler.

If you’ve established that a particular colour belongs in the code, you know you don’t need to consider a second copy of that colour elsewhere. You still have 10 guesses to find the correct arrangement. Easy is a good place to learn how the feedback system works before duplicates enter the picture.

Classic expands the palette to 6 colours, while the secret code remains four pegs long. This time, duplicate colours are allowed. Marty might use a colour once, twice or potentially even more often in the same code. That changes the deduction considerably.

Discovering that blue belongs somewhere in the code doesn’t automatically tell you that you’ve finished accounting for blue. There may be another blue hiding elsewhere. You have the same 10 guesses, but considerably more possible codes to eliminate.

Hard gives Prof. Marty 8 possible colours while keeping the secret code at four pegs and allowing duplicates. You still only have 10 guesses.

The larger colour pool means an early guess can leave you with far more possibilities than it would on Easy or Classic. You’ll need to make better use of every piece of feedback and avoid wasting guesses that don’t teach you anything new.

If Marty looks smug before you’ve even started, this is probably why.

How to Improve your Crack the Code Strategy

Cracking the code isn’t just about making increasingly lucky guesses. A strong guess should either solve the code or teach you something useful about it.

Use Your Early Guesses to Gather Information

Your first few guesses don’t need to look like the final answer. Their job is to give you information. Try colours you haven’t tested and pay attention to how the feedback changes. Once you start establishing which colours are likely to be present, you can shift your attention toward finding their correct positions.

Zero Feedback Is Valuable

A guess that receives no black or white pegs may feel like a disaster. It isn’t. You’ve just learned that none of the colours contributing to that guess belong in the secret code. That can eliminate several possibilities at once. Knowing what’s not in the code is often just as useful as discovering what is.

Separate Colour From Position

A white peg is good news. It tells you that you’ve found a correct colour — you just haven’t found its correct home yet. Don’t immediately throw that colour away on your next guess. Instead, try moving it while using the rest of your feedback to determine where it belongs. Likewise, black feedback tells you that something is already exactly right. The challenge is determining which part of your guess earned it.

Compare Guesses Against Each Other

Don’t treat every row as a separate attempt. Your previous guesses are evidence. Suppose two guesses are almost identical except for one colour, and the second guess produces an additional feedback peg. That difference can tell you something important about the colour you changed. The more carefully you compare one result with another, the less you need to rely on guesswork.

Change One Thing When You Need a Clear Answer

Sometimes making a radically different guess is useful because you’re testing several new colours. Other times, you need a controlled experiment. If you’re unsure whether one particular colour or position is responsible for your feedback, changing only one part of the next guess can help isolate the answer. The key is knowing why you’re making the change.

Don’t Waste Information You’ve Already Earned

If previous guesses strongly suggest that a colour belongs in the code, don’t abandon it without a reason. Likewise, if you’ve ruled a colour out, continuing to use it generally wastes valuable positions that could be testing something new. With only 10 attempts, each guess should build on what you’ve already learned.

 

More Crack the Code Strategy Tips

Dealing With Duplicate Colours

Duplicates are one of the biggest differences between Easy and the higher difficulty levels. On Easy, you don’t have to worry about them at all. On Classic and Hard, you do.

Suppose your feedback has convinced you that red is part of Marty’s code. That doesn’t necessarily mean there’s only one red. The secret could contain something like:

Red – Blue – Red – Green

or even several copies of the same colour. This means you need to be careful when interpreting feedback from guesses that also contain repeated colours. A useful question isn’t simply:

“Is red in the code?”

It’s also: “How many reds could be in the code?”

Testing repeated colours deliberately can sometimes help answer that question.

Read the Whole Board, Not Just Your Last Guess

As you get closer to the solution, it’s tempting to focus entirely on your newest row. Don’t. Every previous guess and every piece of feedback remains useful. Look for combinations that can no longer be possible. If one interpretation of your latest feedback contradicts something you established several guesses earlier, that interpretation must be wrong. Crack the Code becomes much easier when you stop thinking of the board as 10 separate guesses and start treating it as one growing collection of clues.

When You’re Close, Slow Down

Three or even four feedback pegs can make it tempting to start rearranging everything. This is exactly when careful deduction matters most. If you’ve received several black pegs, much of your guess may already be correct. Changing all four positions at once can destroy useful information. Instead, compare the result with your previous rows and ask:

Which colours am I confident are present?
Which positions have already been strongly supported?
Which part of the code is still uncertain?
What single change would give me the clearest new information?

The closer you get, the more valuable a precise guess becomes.

Crack Prof. Marty’s Secret Code

Prof. Marty is the code setter in this game. Once you’ve selected a difficulty, his secret code is created from the colours available under those rules. Marty isn’t changing the answer while you play, no matter how suspicious that moustache looks. Your job is simply to uncover the code he started with. He’ll react to your progress along the way, whether you’re completely missing the mark, getting dangerously close, running short on guesses or finally cracking his code. His commentary won’t solve the puzzle for you. That would rather defeat the point.

A Little Bit of Code-Breaking Game History

Games about discovering a hidden sequence are much older than computer puzzle games. One important predecessor is Bulls and Cows, a traditional code-breaking game usually played with numbers. One player chooses a secret sequence and the other repeatedly guesses it, receiving clues about correct values and correct positions.

The basic idea later became closely associated with colour-based peg games, where players use feedback to narrow down a hidden code. These games are particularly interesting because a guess has two purposes. You might get lucky and find the answer, but more importantly, each attempt is an experiment. A carefully chosen wrong guess can be more useful than a nearly correct guess if it eliminates a large number of possibilities.

That connection between guessing and information has made this style of game interesting to mathematicians and computer scientists as well as puzzle players. Different versions change the number of positions, available symbols, duplicate rules and number of attempts, but the central challenge remains the same:
Make a guess. Study the clues. Eliminate what can’t be true. Then try again.

Want to play more puzzle and logic games?

Check out more puzzle and logic games below

Nonogram

Play Nonogram online for free! Choose 5x5, 10x10, 15x15 or 20x20 boards and solve logic puzzles that sometimes reveal hidden pictures.

Peg Solitaire

Solve the classic, free Peg Solitaire puzzle by jumping and removing pegs until only one remains. Every move matters in this

Sudoku

Play Sudoku online with Easy, Medium, and Hard puzzles. Use notes, hints, and beat the clock while solving every grid with

Minesweeper

Play classic Minesweeper online with Beginner, Intermediate, and Expert modes. Clear the board, avoid hidden mines, and beat your best time.

Tic-Tac-Toe

Play Tic Tac Toe online on 3x3, 4x4, or 5x5 boards. Challenge Marty, Martin, or Martimus and put your strategy to