22
$\begingroup$

Imagine we're playing a game of mastermind with the usual eight colours, only this version has six holes across in which to place colours. And to make it easier for you I tell you that I have filled all six with the same colour.

What is the minimum maximum number of turns you require to get the correct answer? How do you do it?

$\endgroup$
2
  • 5
    $\begingroup$ Do you really mean "maximum"? $\endgroup$ Commented Apr 28, 2019 at 10:51
  • 5
    $\begingroup$ @dennisdeems You should probably interpret the "minimum" as: There is no algorithm that can guarantee a correct answer with a number of turns lower than this "minimum". He wants the "minimum maximum number of turns" (minimum over all algorithms, maximum over all possible outcomes using this algorithm). $\endgroup$
    – mastov
    Commented May 3, 2019 at 12:44

5 Answers 5

38
$\begingroup$

Two guesses are enough to find the color, a third guess to give the correct code.

Name the colors with letter A to H.
Guess 1: AABCDE.
- If you get 2 matches, the color is A.
- If you get 1 match, it is B, C, D or E. Guess 2: CDDEEE. The color is B, C, D or E for respectively 0, 1, 2 or 3 matches.
- If you get 0 match, it is F, G or H. Guess 2: FGGHHH. The color is F, G or H for resp. 1, 2 or 3 matches.
If it is required to complete the game, enter the color everywhere as guess 3.

It is easy to see that with 2 guesses you can find the correct color among even 9.

$\endgroup$
0
9
$\begingroup$

Two. Use 1 peg colour 1, 1 pegs colour 2 and 2 pegs colour 3 and 4 for the first guess. If nothing is recorded, you get left with 4 colours, otherwise you are home and dry. With 4 colours, use 1 peg 1, 2 pegs 2, 3 peg 3. The number of records gives the answer (or none for colour 4).

$\endgroup$
0
4
$\begingroup$

Similar to Florian F's answer, but with a better chance to solve quicker.

Guaranteed in 3 guesses with a 25% chance to solve in 2 guesses

On turn 1 guess ABCCDD:
- If you get 1 match, it's A or B—2 matches it's C or D. Turns 2 and 3 can be AAAAAA and BBBBBB or CCCCCC and DDDDDD respectively to get the correct answer within at most 3 guesses.
- If you get 0 matches on turn 1, guess FGGHHH on turn 2. Guess 3 should be EEEEEE, FFFFFF, GGGGGG, or HHHHHH if you got 0, 1, 2, or 3 matches respectively.

$\endgroup$
0
$\begingroup$

Posted this before reading other answers.

Edit: After reading other posts.

Minimum worst case with best play:

4 3 guesses.

Because:

First turn: use 4 colours, no matter how you do that worst case is no hits and all you know is that it's one of the remaining four.
Second turn: use 2 of the known colours, similarly worst case no hits and all we now know is that it's one of the two remaining colours.
Third turn: use 1 of the known colours, worst case no hit and we get it on the next turn.
Once we know it's 1 of 4 colours we can put them forward in groups of 3, 2, 1, and none (the colour left out).
So the second turns becomes: 3 of one colour, 2 of another with 1 of a third colour. Whatever the score is we'll know the correct colour for the 3rd turn.

$\endgroup$
0
$\begingroup$

My algorithm will probably be almost the same as the others but I just wanna show another way. So my answer is

Require 3 guesses to guarantee know the colour

My explanation

Label my colours as A, B, C, D, E, F, G and H First Guess: ABBCCC. If 0 match, the colour is D, E, F, G or H. If 1 match, the colour A. If 2 matches, the colour is B. If 3 matches, the colour is C. If 0 match in the first guess, proceed to second guess. Second guess: DEEFFF. Same logic as first guess. If 0 match, the colour is either G or H. If 1 match the colour D. If 2 matches, the colour is E. If 3 matches, the colour is F. If 0 match in the second guess, proceed to third guess. Third guess: GGGGGG: If all correct, the colour is G. If all wrong, the colour is H.

$\endgroup$
2
  • $\begingroup$ In your example, if the colour is H you will solve it on the fourth turn. This puzzle is always solvable on the third. $\endgroup$ Commented May 5, 2019 at 21:46
  • $\begingroup$ Sorry, I confuse guesses with turns $\endgroup$ Commented May 6, 2019 at 0:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.