I read the other thread regarding Knuth's algorithm and mastermind but I still do not understand quite how it would be implemented. I am confused by the language or my brain is just broken (or both).
I understand that you start with a list S of all possible permutations based on the particular game's parameters, for example a list of 1296 possible 4-digit combinations where each digit can be a number 1-6 (including repeats).
You create a 4 digit secret code.
You play a guess (from the list S) against the secret code and receive a response in terms of black and white "pegs", where each black peg means the guess has the right digit in the right spot, and each white peg means the guess has the right digit in the wrong spot.
According to Knuth, you should always use 1122 as the first guess, from which you get a response in terms of black and white pegs.
Then, in order to reduce the number of possible guesses for the next turn and eventually find the right code, if the response is not 4 black pegs (meaning the code has been guessed correctly and the game's over), we are to remove from S any element (guess, code, whatever you want to call it) that would not give the same response if it (the guess/code/element in S) were the code.
What does that mean? Is anyone else confused by that wording?
I do not understand what comparison is being made here. To me, this means that if the response to the first guess of 1122 is one black, one white, we would remove from S all of the potential guesses that, when played against the secret code, would not return the same response of one black, one white. That would of course leave us with a list of possibilities that would not contain the correct answer, because it would just be a list of elements that would all get a response of one black, one white.
So I see that obviously that can't be what it means, so the alternative is to say "OK it must mean that you should remove from S every potential guess that also returns the one black, one white) answer and go from there." That makes more sense than my initial interpretation but it still doesn't feel right.
Can anyone help explain this using multiple examples? I cannot wrap my head around what comparison is being made and what two things are actually being compared in order to remove elements from S.