3
$\begingroup$

Mastermind is a code-breaking game for two players where people try to guess the opponents guesses. You can find the detail on wikipedia.

The game you play with your friend is a little different, a type of mastermind with using all digits available ($0-9$) with $4$ digit numbers.

Your friend keeps a $4$ digit number (all digits are distinct) and you try to guess it as below:

5178  0 -2
9017 +1 -1
4879 +1 -1
9128 +1 -2
1704  0 -2

After getting these keys (+,-) you notice that something is wrong with the keys. After telling this to your friend, your friend rechecked the information he gave and then notice one of the keys he provided is wrong and he tells you that you can still find it without that guess and the keys with it.

Which guess is wrong and what is the number your friend kept?

$\endgroup$
1
  • 3
    $\begingroup$ what exactly do + and - mean? Which one is "right digit on right position" and which one is "right digit, wrong position"? $\endgroup$
    – Novarg
    Commented Aug 10, 2017 at 8:39

2 Answers 2

3
$\begingroup$

The answer is:

9810 is the number, 9017 is the wrong guess.

Here's why.

Try to guess and check. Going through each guess, we find that only removing 9017 gives a unique solution, removing the others either gives multiple solutions, or makes it invalid. Since your friend said that it was possible to find the answer, that means you need to remove 9017, since it is the only one with a unique solution.

$\endgroup$
4
$\begingroup$

The possible solutions depending on the guess that is clued incorrectly:

If 9128 is wrong:

0827 or 0837 or 0867.

If 4879 is wrong:

9841 or 9481.

If 1704 is wrong:

9831 or 9861.

If 9017 is wrong:

There is a unique solution: 9810.

If 5178 is wrong:

The other four clues invalidate the entire solution space.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.