---
title: "Mindo and Mastermind: Knuth's optimal strategy explained · SIWA"
description: "Why every Mindo code can be cracked in 5 tries: Knuth's minimax strategy, the 1 1 2 2 opener and what it all means for your daily game."
canonical_url: "https://dev.siwa.io/en/guides/mindo-strategie-mastermind"
last_updated: 2026-10-27
locale: en
meta:
  "og:description": "Why every Mindo code can be cracked in 5 tries: Knuth's minimax strategy, the 1 1 2 2 opener and what it all means for your daily game."
  "og:image": "https://dev.siwa.io/og/en/mindo.jpg?v=a13dcf2f"
  "og:image:alt": "Mindo · Crack the secret 4-colour code"
  "og:image:height": "630"
  "og:image:type": image/jpeg
  "og:image:width": "1200"
  "og:title": "Mindo and Mastermind: Knuth's optimal strategy explained"
  "twitter:image": "https://dev.siwa.io/og/en/mindo.jpg?v=a13dcf2f"
  "twitter:image:alt": "Mindo · Crack the secret 4-colour code"
---

> Index of every page on this site: [llms.txt](https://dev.siwa.io/llms.txt)

How to play

# Mindo and Mastermind: Knuth's optimal strategy explained

Mindo follows the exact rules of classic Mastermind, and the computer scientist Donald Knuth proved that with the right strategy, any code of 4 colours out of 6 can be found in 5 tries or fewer, starting with 1 1 2 2. Here is how that strategy works, what research has found since, and how to turn it into a method you can actually use within Mindo's 10 tries.

Updated October 27, 2026

[Play Mindo](https://play.dev.siwa.io/game/mindo)

## Is Mindo really Mastermind?

Yes, strictly speaking. The [Mindo](https://dev.siwa.io/en/games/mindo) code has 4 positions, each taking one of 6 colours, repeats included: that makes 6 × 6 × 6 × 6 = 1,296 possible codes. After each try, the game gives two numbers, colours in the right spot and colours in the code but misplaced, counted exactly as in Mastermind.

So all the published theory on 4-position, 6-colour Mastermind applies to Mindo as it stands. Only the playing conditions differ: 10 tries at most, and a score that takes tries, time and jokers into account.

Below, colours are named by their number in the palette, from 1 to 6.

## What did Donald Knuth prove?

In 1976-1977, Donald Knuth published a strategy in the *Journal of Recreational Mathematics* that finds any code in **5 tries or fewer**. His method is called "minimax": at each move, it picks the guess that minimises the number of codes still possible in the worst case.

In practice, for every possible guess, you look at all the answers the game could give. Each answer leaves a certain number of consistent codes. You note the worst one, then pick the guess whose worst case is smallest. The chosen guess is not necessarily a code that could still win: it can be played purely for the information it brings.

This strategy takes 4.478 tries on average. It is not the best on average, but it guarantees the worst case.

## Why open with 1 1 2 2?

Knuth's opener is **1 1 2 2**: two pairs of colours. According to the figures reported by Wikipedia, other openers such as 1 1 1 1, 1 1 1 2, 1 1 2 3 or 1 2 3 4 cannot guarantee a win in 5 moves with this algorithm.

Working out the worst case shows why. For each type of opener, here is the largest number of codes that can remain after the answer:

- **1 1 2 2**: 256 codes at worst;
- **1 1 2 3**: 276 codes;
- **1 2 3 4**: 312 codes;
- **1 1 1 2**: 317 codes;
- **1 1 1 1**: 625 codes.

With 1 1 2 2, the 1,296 codes are spread over 13 possible answers. The three worst, "0 right spot, 0 wrong spot", "0 and 1" and "1 and 0", each leave 256 codes. At the other end, "2 right spot, 2 wrong spot" leaves only 4.

A good guess splits the possibilities into many small groups rather than a few big ones. Four different colours test more colours at once, but their worst answer leaves more codes.

## Can you beat Knuth?

On average, yes. In 1993, Koyama and Lai used an exhaustive search to find the strategy that minimises the average number of tries: about **4.340**, but with a worst case of 6 tries. Add the constraint of never going beyond 5 tries, and the best average becomes about 4.341.

Another result useful to a human player: around 1999-2000, Swaszek studied very simple strategies. Playing a random code that fits every answer so far averages 4.638 tries. That is barely 0.3 tries more than the optimum, with no partition maths at all.

## How do you apply this theory to Mindo?

Nobody runs a minimax over 1,296 codes in their head. But three ideas scale down to human play very well.

**Open with two pairs.** 1 1 2 2 guarantees the best worst case. If you prefer a method that is easy to follow, carry on with 3 3 4 4 then 5 5 6 6: in three tries, you know the make-up of the code pair by pair, as in the commented game of our [beginner's guide](https://dev.siwa.io/en/guides/comment-jouer-a-mindo).

**Only play consistent codes.** That is the strategy Swaszek studied, and it is enough to win in under 5 tries on average. Check each guess against every earlier row before you submit.

**Split the field in the endgame.** When 3 to 6 candidates remain, look for the guess that best separates them. It is the one moment where the minimax idea is easy to work out by hand.

## How Mindo's scoring changes the strategy

Mindo gives you 10 tries, so Knuth's 5-try guarantee is not a matter of survival. Each extra try, however, costs about 67 points of performance out of 1,000. It is your **average** number of tries that drives your score, more than the worst case.

Time counts too, with a bonus under 2 min 30 s and a penalty beyond. A simple, quick method such as consistent guessing is often worth more than a perfect but slow search.

Finally, the joker is especially expensive in Mindo: 60 points per joker, and a score capped at 700 with one joker, 450 with two, 200 with three. The theory shows you never need one to win: keep it to avoid a loss, which is capped at 400 points. Our [Mindo tips](https://dev.siwa.io/en/guides/astuces-mindo) go into these choices, and [Decrypto](https://dev.siwa.io/en/games/decrypto) offers another daily code to crack, with digits.

## Sources

- [Mastermind (board game), Wikipedia](https://en.wikipedia.org/wiki/Mastermind_%28board_game%29): Knuth's algorithm, the 1122 opener, Koyama and Lai's results.
- [Mastermind, Wolfram MathWorld](https://mathworld.wolfram.com/Mastermind.html): averages for Knuth, Koyama and Lai, and Swaszek's strategies.
- Worst cases per opener were computed by us over all 1,296 codes, using Mindo's counting rules.

## Frequently asked questions

<details>

<summary>Can you always crack the Mindo code in 5 tries?

</summary>

Yes, in theory. Mindo follows the classic Mastermind rules, for which Donald Knuth published a strategy in 1976-1977 that finds any of the 1,296 codes in 5 tries or fewer.

</details>

<details>

<summary>Why is 1 1 2 2 the best opener?

</summary>

It guarantees the smallest worst case: whatever the answer, at most 256 codes remain possible. With 1 2 3 4, up to 312 can remain, and 625 with 1 1 1 1.

</details>

<details>

<summary>How many tries does Mastermind take on average?

</summary>

Knuth's strategy takes 4.478 tries on average. The best known average, established by Koyama and Lai in 1993, is about 4.340 tries.

</details>

<details>

<summary>Do you need to calculate like a computer to play Mindo well?

</summary>

No. Always playing a code that fits every answer received so far gives an average of about 4.6 tries, which leaves plenty of margin within Mindo's 10 tries.

</details>

## Ready to play?

Today's grid is waiting, free and without sign-up.

[Play Mindo](https://play.dev.siwa.io/game/mindo)

## More guides

[SSBPBODM<h3>Daily logic games</h3>Sudoku, Takuzu, nonogram, Slitherlink, Mastermind: eight free logic games with a new grid every day. In your browser, no sign-up.PicksRead the guide](https://dev.siwa.io/en/guides/jeux-de-logique-quotidiens) [MDTO<h3>Games like Mastermind</h3>Love Mastermind? Mindo has you crack a 4-colour code in 10 tries, Decrypto switches to digits. Two more deduction games, free every day in the browser.AlternativeRead the guide](https://dev.siwa.io/en/guides/jeux-comme-mastermind) [TDMPMR<h3>Games like Wordle</h3>Love Wordle? Six free games in the same spirit: mystery word, secret code, semantic proximity, anagrams. One grid a day, no sign-up.PicksRead the guide](https://dev.siwa.io/en/guides/jeux-comme-wordle)

[Play Mindo](https://play.dev.siwa.io/game/mindo)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://dev.siwa.io/#identity","@type":"Organization","email":"hello@siwa.io","name":"SIWA","url":"https://dev.siwa.io/","logo":{"@id":"https://dev.siwa.io/#logo"}},{"@id":"https://dev.siwa.io/#website","@type":"WebSite","inLanguage":"en-US","name":"SIWA","url":"https://dev.siwa.io/","publisher":{"@id":"https://dev.siwa.io/#identity"}},{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#webpage","dateModified":"2026-10-27","datePublished":"2026-10-27","description":"Why every Mindo code can be cracked in 5 tries: Knuth's minimax strategy, the 1 1 2 2 opener and what it all means for your daily game.","name":"Mindo and Mastermind: Knuth's optimal strategy explained","url":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind","@type":["WebPage","FAQPage"],"breadcrumb":{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#breadcrumb"},"isPartOf":{"@id":"https://dev.siwa.io/#website"},"mainEntity":[{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#/schema/question/1"},{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#/schema/question/2"},{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#/schema/question/3"},{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#/schema/question/4"}],"potentialAction":[{"@type":"ReadAction","target":["https://dev.siwa.io/en/guides/mindo-strategie-mastermind"]}],"primaryImageOfPage":{"@id":"https://dev.siwa.io/#logo"}},{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#article","@type":"Article","dateModified":"2026-10-27","datePublished":"2026-10-27","description":"Why every Mindo code can be cracked in 5 tries: Knuth's minimax strategy, the 1 1 2 2 opener and what it all means for your daily game.","headline":"Mindo and Mastermind: Knuth's optimal strategy explained","inLanguage":"en","mainEntityOfPage":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind","thumbnailUrl":"https://dev.siwa.io/og/en/mindo.jpg?v=a13dcf2f","author":{"@id":"https://dev.siwa.io/#identity"},"image":{"@id":"https://dev.siwa.io/#/schema/image/1"},"isPartOf":{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#webpage"},"publisher":{"@id":"https://dev.siwa.io/#identity"}},{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://dev.siwa.io/en","position":1},{"@type":"ListItem","name":"Guides","item":"https://dev.siwa.io/en/guides","position":2},{"@type":"ListItem","name":"Mastermind strategy","position":3}]},{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#/schema/question/1","@type":"Question","inLanguage":"en-US","name":"Can you always crack the Mindo code in 5 tries?","acceptedAnswer":{"@type":"Answer","text":"Yes, in theory. Mindo follows the classic Mastermind rules, for which Donald Knuth published a strategy in 1976-1977 that finds any of the 1,296 codes in 5 tries or fewer."}},{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#/schema/question/2","@type":"Question","inLanguage":"en-US","name":"Why is 1 1 2 2 the best opener?","acceptedAnswer":{"@type":"Answer","text":"It guarantees the smallest worst case: whatever the answer, at most 256 codes remain possible. With 1 2 3 4, up to 312 can remain, and 625 with 1 1 1 1."}},{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#/schema/question/3","@type":"Question","inLanguage":"en-US","name":"How many tries does Mastermind take on average?","acceptedAnswer":{"@type":"Answer","text":"Knuth's strategy takes 4.478 tries on average. The best known average, established by Koyama and Lai in 1993, is about 4.340 tries."}},{"@id":"https://dev.siwa.io/en/guides/mindo-strategie-mastermind#/schema/question/4","@type":"Question","inLanguage":"en-US","name":"Do you need to calculate like a computer to play Mindo well?","acceptedAnswer":{"@type":"Answer","text":"No. Always playing a code that fits every answer received so far gives an average of about 4.6 tries, which leaves plenty of margin within Mindo's 10 tries."}},{"@id":"https://dev.siwa.io/#logo","@type":"ImageObject","caption":"SIWA","contentUrl":"https://dev.siwa.io/logo-siwa.svg","inLanguage":"en-US","url":"https://dev.siwa.io/logo-siwa.svg"},{"@id":"https://dev.siwa.io/#/schema/image/1","@type":"ImageObject","contentUrl":"https://dev.siwa.io/og/en/mindo.jpg?v=a13dcf2f","inLanguage":"en-US","url":"https://dev.siwa.io/og/en/mindo.jpg?v=a13dcf2f"}]}
```

## Sitemap

See the full [sitemap](https://dev.siwa.io/sitemap.md) for all pages.
