:
I think what's stopping me from being able to help out is I'm struggling to understand how the "Mastermind" code works, and I really think that's the key to figuring out what we need and what we can "discard". I've just looked up 3 different sets of rules to the Mastermind game, and even using the logic Dawlthy put in his original post I can't seem to get the same answer he did with any of the rule variations. That's probably me being stupid, though.  Can anyone further explain how it works?
|
I'll give it a go, but my explanations are usually hard to follow.
The mastermind code is slightly different to what we've been asked to do now in that it doesn't tell you what to keep or discard. Instead it tells you how many of the numbers on each row are correct, but not which ones.
A / means that one of the numbers in that row is correct and in the correct position, but doesn't specify which of the numbers it is.
A \ means that one of the numbers in that row is part of the solution, but it is in the wrong position. Again not specifying which number that is.
The first puzzle is this.
A9539 \\
B2919 /\\
C4882 /\
D4627 \
E6758 \
F???? ////
Looking at the first row we have 9539 \\
This means that two of the numbers in that row are part of the solution, but in the wrong position. The other two are not part of it at all. With this clue on its own we don't know which two they are.
The second row is 2919 /\\
Again we know that two numbers are part of the solution, but in the wrong position ( the two \\). We also know that another number is correct and in the right position (the /). Because we know that at least three of the numbers in this row are part of the solution, but only two of them are in the first row, we can see that the two numbers are the two 9's. We also know that either a 1 or a 2 is also part of the solution.We can also see that the two nines have to go in the middle two position (because we know that cannot be in the end positions due to line A). At this point we know the solution to be ?99?.
The third line is 4882/\
In this line we see that one number is correct and in the correct position (the /). We also know that another number is in the solution but in the wrong position (the \). We know that neither of the 8's is in the correct position, because those two numbers are 9's. This means either the 4 or the 2 is in the correct place(the /), and the final solution contains a 4, an 8, or a 2(the \). We now have four options: 499?, ?994, 299? of ?992. Using the previous clues we know the remaining ? is either a 1 or an 8
The fourth line is 4627\.
This tells us that the 499? option above must be wrong, because we would have a / instead if it wasn't. because of this we know the number that was in the correct position in line three was actually the 2. This leaves us knowing the number at this point to be ?992.
The fifth line is 6758\
This tells us that the one remaining number is in this line somewhere. As we already know it is either a 1 or an 8 we are looking for, we know the remaing digit is 8. Giving us 8992
EDIT:
Ha in the time it took me to write that, it was already answered twice but never mind. Also mayber theres more than one way of playing mastermind, but in the rules i have the pegs on the board do not correlate to the position. You are supposed to place them from left to right in the slots regardless of the position of the correct numbers. It is as above, they only let you know that any one of the numbers is correct