login
A231205
Table of maximal number of guesses required to solve a Mastermind variant, read by columns.
0
0, 1, 1, 2, 1, 2, 3, 2, 2, 3, 4, 2, 5
OFFSET
1,4
COMMENTS
The table is the maximum number of guesses required to absolutely identify a code from n colored pegs in k slots with no repetition, where marking is ordered and uses 3 types of peg - gray indicating the color isn't present, white indicating the color is present but in the wrong position and black indicating the color is present and in the right position.
Ordered marking means the codemaker marks from left to right and places a marking peg in the corresponding slot in the answer grid.
Note that the sequence only gives the number of guesses required, not the number of turns required. If for example we have 2 colors and 2 slots, and we guess RG and get marked ww, we now know the answer is GR, and this is not counted as necessary to guess.
T(3,2)=1 because with 3 colors, say c1, c2 and c3, then any answer to, say, the guess c1|c2 tells you the answer - if it's ww the answer is c2|c1, bb -> c1|c2, gw -> c2|c3, wg -> c3|c1, gb -> c3|c2 and bg -> c1|c3. The answers bw, wb and gg are all impossible.
T(4,3)=2 because the worst case scenario involves the 1st guess returning www or some form of wwg.
LINKS
Mastermind Optimal Strategy, Reference for a(13)
Web Games Online, Online MasterMind.
Eric Weisstein's World of Mathematics, MasterMind.
Wikipedia, MasterMind.
FORMULA
T(n,1)=n-1.
T(n,2)=floor(n/2).
T(n,n)=n-1.
EXAMPLE
With 6 colors (RGYBOP) and 4 slots, say the code is YBRG. The guess BORP should be marked wgbg.
The table starts:
Colors
Slots | 1 2 3 4 5 6
-------------------------------
1 | 0 1 2 3 4 5
2 | x 1 1 2 2
3 | x x 2 2 5
4 | x x x 3
5 | x x x x 4
6 | x x x x x 5
CROSSREFS
Cf. A004523.
Sequence in context: A079056 A341839 A366509 * A003984 A087061 A344838
KEYWORD
nonn,tabl,more
AUTHOR
Jon Perry, Nov 05 2013
EXTENSIONS
a(13) from David Consiglio, Jr., Oct 24 2023
STATUS
approved