DISCLAIMER: I DO NOT SEEK A SOLUTION FOR Mastermind.
I'm trying to write a program to solve a game like a mastermind, and I'm a little stuck. I do not want a complete solution, only help with the part that I can’t get through. Here is the game:
Known Npossible colors, known in advance. There is an unknown set (possibly with repetitions) kthat is selected and kept secret. The goal is to guess the colors (with repetitions) in a secret set. Let me emphasize once again that this is a set, so the order does not matter, but repetitions are allowed. for instance
The colors are a,b,c,d,e,f,g,h( N=8), and the unknown value is {a,c,c}( k=3).
Successive conjectures have been made that lead to additional information about the secret set. Each conjecture should be a set (repetition allowed) of colors k. The answer to each guess is the number of colors common between assumptions and vague repetition counts. for instance
Guess a,d,eThe Result:1
Guess b,c,fThe Result:1
Guess a,a,gThe Result:1
Guess a,c,hThe Result:2
Guess b,e,hThe Result:0
Guess made by someone else. My goals:
- determine when information about a particular color is known.
- determine when an unknown set can be inferred.
( N>1). , 0, , , . k, , , . . , . , , a,c,c. :
- 5,
b,e,h - 4,
a,c - 1,
d - 2,
f - 3,
g a c.- 3,
a . a,c,c.
, , . - , . , . .