# Single Colour Mastermind Problem

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?

• Do you really mean "maximum"? – dennisdeems Apr 28 at 10:51
• @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). – mastov May 3 at 12:44

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.

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).

• But there are 8 colors! – Florian F Apr 28 at 9:35
• @FlorianF; fixed. – JonMark Perry Apr 28 at 9:41

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.

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.

• In your example, if the colour is H you will solve it on the fourth turn. This puzzle is always solvable on the third. – Reggie Pinkham May 5 at 21:46
• Sorry, I confuse guesses with turns – Simon-Nail-It May 6 at 0:47