5
$\begingroup$

Here is an altered mastermind puzzle which instead of colored pegs I used digits from 1 to 9 without any repetition. The picture below shows four guesses and their corresponding scores.The black pegs are for every correct digit and correct position and the white pegs are only for the correct digits and wrong position. Your mission is to break the code on the fifth guess and find what the hidden number is. Good luck. N.B. for those who are not familliar with mastermind game I suggest to visit this site: https://en.wikipedia.org/wiki/Mastermind_(board_game) enter image description here

$\endgroup$
  • $\begingroup$ this can't be solved. there is a black peg and a white peg for the same number and position first of all. Second, there is a black peg at the same spot even though the number is different. $\endgroup$ – sam-pyt Oct 22 '17 at 1:06
  • 1
    $\begingroup$ @9.0 the black and white pegs don't necessarily represent the same position $\endgroup$ – boboquack Oct 22 '17 at 1:10
  • 1
    $\begingroup$ @boboquack but OP says "black pegs are for every correct digit and correct position " ... ? $\endgroup$ – sam-pyt Oct 22 '17 at 1:16
  • 2
    $\begingroup$ For each correct digit in the correct position, you get a black peg on the left in some place. @9.0 $\endgroup$ – boboquack Oct 22 '17 at 1:19
  • 1
    $\begingroup$ @boboquack - oh. $\endgroup$ – sam-pyt Oct 22 '17 at 1:48
6
$\begingroup$

The code is:

6741

Process:
Note: When I speak of a number being white or black, I mean that it is represented by a white or black peg respectively.

5 and 8 cannot be the black in row 4, otherwise there would be a black in row 2 or 3. So neither 5 or 8 are in the code, since there is no white in row 4.
Similarly, neither 1 nor 2 can be the black in row 1, since there would then be a black in row 2. So 6 must be the black in row 1, and the first digit of the code.
Now, 4 must be a white in row 2, because otherwise both 1 and 2 are whites, contradicting row 1. So 4 is also a white in row 3.
If 2 were the white in rows 1 and 2, 1 must not be in the code. So 3 would be in the code, but then we have 5 digits in the code - 6, 2, 3, 4 and the 7 or 9 from row 4. So 2 is not the white in row 1 or 2.
So 1 is the white in rows 1, 2 and 3. 1 cannot be the first digit in the code, since 6 is. By the positioning of the white 1 in rows 1, 2 and 3, the 1 can't be the second or third digit either. So 1 is the fourth digit.
Now, 9 can't be black in row 4, since it would be the fourth digit and we know 1 is the fourth digit. So the 7 is black in row 4, and the second digit of the code.
Then the 4 must be the third digit of the code, since we know it is white.

$\endgroup$
  • $\begingroup$ excellent. Well done. $\endgroup$ – Seyed Oct 22 '17 at 10:07
5
$\begingroup$

The solution is:

6741

Because:

From 1,2: In 1 the black dot is not the 1 or 2.
From 1,3: The black dot in 1 is not the 5.
Therefore the code starts with 6.
From 3,4: The 5 is not the black dot in 4.
Therefore 5 is not in the code.
From 1:Only 1 or 2 is part of the solution.
From 2:Only 4 or 8 is part of the solution.
From 2 and 4: 8 is not the black dot in 4.
Therefore 8 is not in the code.
So 4 is in the code.
From 4:Only 7 or 9 is part of the solution.
So the solution contains: (6), (7 or 9), (4), (1 or 2)
From 3:1 is part of the solution.
From 1,2,3: 1 is the last digit of the code.
From 4: 7 is the second digit of the code.
So 4 is the third digit of the code, making the code: 6741

$\endgroup$
  • $\begingroup$ How is this fundamentally different to my solution? $\endgroup$ – boboquack Oct 22 '17 at 1:27
  • 1
    $\begingroup$ It is not, i think, i just started to work on a solution till i finished it, than posted it, after i posted it i saw yours. I enjoyed to find the solution, and happened to write it down as i advanced, in that way it has nothing to do with your solution. I do admit you were faster. $\endgroup$ – Nopalaa Oct 22 '17 at 1:49
  • $\begingroup$ Good work, well done. $\endgroup$ – Seyed Oct 22 '17 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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