# Crack the lock code

Does any one know how to crack this? I got this as a challenge.

• Welcome to Puzzling! – Deusovi Dec 19 '16 at 7:06
• Reminds me of the game of Mastermind – Kevin Rock Dec 19 '16 at 18:16
• Hard mode: as delightfully noted by @JollyJoker in his/her answer below, this problem is overdetermined and can be solved by omitting clues 4 and 5, the insight for which makes it a far more beautiful puzzle. Try it that way first. – CR Drost Dec 21 '16 at 0:47
• this is pretty easy variation of mastermind question, i am not sure what the difference is? this is also called Electronic Mastermind (Invicta). – Oray Dec 21 '16 at 8:19

The code is:

042

Explanations:

One number is correct and is also correctly placed:

2

One number is correct but wrongly placed:

4

Two numbers are correct and wrongly placed:

0 & 2 incorrectly placed

Nothing is correct:

None of them are in the code

One number is correct but wrongly placed:

0

Approach/Thought Process Chosen

682 - One number is correct and well placed

Correct Number's array - 6,8,2
Confirm Number's array -

614 - One number is correct but wrong placed

Correct Number's array - 8,2,1,4(6 is removed since this clue contradicts the previous one and hence 6 should not be present even in the code-The position of 6 is same in Clue 1 and 2 which mean's it can be pushed out of scope)
Confirm Number's array -

206 - Two Numbers are correct but wrong placed

Correct Number's array - 8,2,1,4,0
Confirm Number's array - 0_2(Since 6 is out of scope, consider 2 and 0 to be in the confirm array list and clue 1 says 2 is well placed )

738 - Nothing is correct

Correct Number's array - 0,2,1,4(8 is removed from the array)
Confirm Number's array - 0_2

780 - One Number is correct but wrong placed

Correct Number's array - 0,2,4(Clues 3 and 5 confirms the position of 0 to be the first. Clues 1 confirms the position of 2. Clue 2 confirms the position of 4 and hence 1 is removed from the list)
Confirm Number's array - 042

• It may just be me... but in my opinion your explanation does not actually explain anything. "One number is correct and is also correctly placed", but why is this specific number the one that's correct, why not any of the other two? – Stephan Bijzitter Dec 21 '16 at 11:55
• @StephanBijzitter-It's just that I posted the answer first with the explanation part later(check the edits). But there were better answers(like this),so didn't feel that I need to add anything else. This one is accepted only due to the reason that it was first. Also, the puzzle was a simple one so I thought I can just post the answer with the reasons. – Techidiot Dec 21 '16 at 12:02
• Sounds like a perfect example of meta.stackexchange.com/questions/9731/… – Stephan Bijzitter Dec 21 '16 at 13:40
• @StephanBijzitter- I have solved many of these recently. I never thought it would require any explanation. But, thought later to add some. Here's one I solved recently last month sample Also, accepting the answer is not my call for sure. You can check out one of my comment where I appreciated the other answer. – Techidiot Dec 21 '16 at 13:46
• @StephanBijzitter- Hope the update doesn't disappoint you. Thanks for pushing me to do that :) – Techidiot Dec 21 '16 at 14:33

You can see from clue 4 that there are no 7, 3, or 8.

You can see from clue 5 that there is a 0 in either the first or second slot, and from clue 3 that it must be in the first slot. That means the code is [0][?][?].

6 cannot be the correct number from clue 1, since it would have to be in the wrong position for clue 2. We already know 8 is incorrect, so 2 must have to be correct, and it must be in the third slot.

This means the code is [0][?][2].

Finally, from the second clue, we can see that one number is correct but in the wrong place. It can't be 6, since we ruled that out already. It can't be 1, since that would be in the correct place. Therefore the code is 042.

• The first clue is not satisfied. – PeteyPii Dec 19 '16 at 7:07
• @QaisarSatti: What? No he didn't. I answered two minutes before him. – Deusovi Dec 19 '16 at 9:03
• @Deusovi no offense but your first answer was wrong. you delete the answer then re-edit it. he added the explanation later. so in my point of view he deserve it – Qaisar Satti Dec 19 '16 at 9:06
• @Qaisar: Yeah, my point was that he added the explanation after I fixed my post. I'm not complaining, just letting you know that he didn't fully answer first. – Deusovi Dec 19 '16 at 9:18
• This explanation is better than the accepted answer because the accepted answer doesn't explain the thought process as well. – Manuel Hoffmann Dec 21 '16 at 11:04

My solution:

• Clues 1 & 2 say number 6 is not included as it cannot be in both the wrong and the right place at the same time
• Clue 3 then says 2 and 0 are included
• Clue 1 then says 2 must be in the last position
• Clue 3 then says 0 must be in the first position
• Clue 2 then has 1 & 4 as possible values, but only 4 is not in the middle position

042, clues 4 and 5 are unnecessary.

• Welcome to Puzzling. We generally don't add answers that say the exact same thing as previous answers. – Mithical Dec 19 '16 at 13:15
• @Mithrandir I don't see another answer that doesn't use clue 4? – JollyJoker Dec 19 '16 at 13:48
• Sorry you had a rude welcome. This is the best answer for efficiency and the very concise format of the answer. Extremely easy to follow. – person27 Dec 19 '16 at 22:15
• this one deserves to be the top answer – Sharun Dec 21 '16 at 5:49
• Nice :) And we can't avoid using any of the first three clues (even if we do use 4 and 5) : clues 2,3,4,5 are consistent with 021; clues 1,3,4,5 are consistent with 012; and clues 1,2,4,5 are consistent with 102. – Especially Lime Dec 21 '16 at 9:07

From the first clue,

the code contains either a $6$, or an $8$, or a $2$.

From the fourth clue,

it can't be an $8$. Further, based on the second clue, it can't be a $6$...because then the $6$ in the first spot would be both well-placed and wrong-placed simultaneously, which is a contradiction.

Hence there must be

a $2$, and it must be in the third place. Further, there must not be a $6$ or an $8$.

Now by the third clue, the code must contain

a $0$, though not in the second place. Since we know the third place has a $2$, we know that $0$ belongs in the first place. It remains to find the middle number.

By the second clue, the code contains

either a $1$ or a $4$, since we have previously ruled out any $6'$s. Further, the middle number can't be a $1$ since then it would be well-placed in the second clue. Therefore the code is $042$.

As it turns out,

We do not need the fifth clue at all.

I really enjoyed this

Here is how I deduced this:

I started off with clue #4 (nothing is correct).

There we can remove any 7s, 3s or 8s from the other clues.

Knowing this, I moved onto clue #5 (one number is correct but wrong placed)

and was able to remove 7 & 8, leaving 0 behind. According to the clue, 0 is in the wrong place, so we know 0 is in either position 1 or position 2.

We now look at clue #3 (two are correct but wrong placed).

We know one of the two is 0 and due to it being incorrectly placed in this clue, we know for certain 0 is in position 1.
So far, we have our code to be 0XX.

Now if we look at clues #1 and #2. Clue #1 states that one number is correct and correctly placed, and clue #2 states that one number is correct but wrongly placed.

The number 6 is in the same position for both clues, so we can know for certain that 6 is not in our code.

We can now go back to clue #3 and be certain that,

due to 6 no longer being a possibility, our code contains both 0 and 2. We know 0 is in position 1, and because of clue #1, we know that 2 is in position 3. We know this because we have ruled out 6 from the equation just now, and 8 was ruled out earlier.
So far we have 0X2

The last bit is easy. We look at clue #2 again. "One number is correct but wrong placed"

position 1 and position 3 are both occupied by 0 and 2. Our final number cannot be 1, because 1 is in position 2 in our clue, but our clue states our number is wrongly placed. We know from earlier deduction that is isn't 6 either, so the final number MUST be 4. 4 is wrongly placed in this clue.

We move our final number into position 2 and we have:

042

Hope this helps.

Really nice. Didn't know puzzling.se exists...

So my solution is:

042

Because:

1:682 and 4:738 says that 8 isn't in it. makes 1:6X2

and

1:6X2 and 2:614 says that 6 dosn't match eighter 'cause 6 can't be right and wrong placed at once. makes 1:XX2

and

3:206 is in fact 0XX 'cause 2 is the last digit and 6 is not part of it. but 0 is on the wrong place. makes 0XX.

Again line 2

2:614 wich is X14 'cause 6 id off. 4 is place wrong. only the numer in the middle is missing: makes X4X.

All together:

XX2 | 0XX | X4X => 042

I got

042

I got my answer by starting at section 4 then 5 then 1 and 2 gave me the answer for 3 which solves the puzzle.

Here's my dumb logic hahaha, did it in notepad:

6-x-2 (one correct and place) C
not 7 or 3 or 8
x-x-0 (one correct and wrong place)
2-0-6 (2 correct but wrong place) A
6-1-4 (one correct but wrong place) B

0 is correct
0-x-x

2-0-6 (2 correct but wrong place) A
6-1-4 (one correct but wrong place) B
6-x-2 (one correct and place) C

A: 2 or 6 is right, but wrong place
B: 6 or 1 or 4 is right but in wrong place
C: 6 or 2 correct and right place

6 is in all 3, if we assume it is right, then
6 is not in 3rd place, it is not in first place
and it is correct in first place, so illogical
therefore 6 is wrong, take out 6

A: 2 is right, but wrong place
B: 1 or 4 is right but in wrong place
C: 2 is correct and right place

therefore: 0-x-2

remainder:

B: 1 or 4 is right but in wrong place

4 is in the wrong place, therefore:

• This repeats what the other answers gave, and doesn't use spoilers. – ClickRick Dec 21 '16 at 14:26
• @ClickRick The whole point of a puzzle is to do it without looking at already given answers, and doing so for "fun", or "brain exercise", I was just showing how I worked it out. This was my first post in this forum, so sorry for not being familiar with "spoiler" function. – almost a beginner Dec 22 '16 at 3:25

All of the answers so far assume that for some reason mastermind rules apply to this puzzle. The tag was added a couple of days ago. Of course you need to make some assumptions to solve this puzzle, I will assume the puzzle is using base ten among other things, but I will not assume that mastermind's rules apply. Only thing that is relevant are the statements in the picture.

So all we have to go by are these statements:
a - 682 One number is correct and well placed
b - 614 One number is correct but wrong placed
c - 206 Two numbers are correct but wrong placed
d - 738 Nothing is correct
e - 780 One number is correct but wrong placed

With that in mind there are two correct solutions to this puzzle. 062 and 042.

I will explain why 062 is a correct solution.
Statement a - 2 is in the correct place. There is a number that is correct and in a wrong place, but that would only mean that the statement is inaccurate according to mastermind's rules. The statement on it's own that "One number is correct and well placed" is still true.
Statement b - 6 is in the wrong place.
Statement c - All of the numbers are in the wrong place. So the statement "Two numbers are placed wrong" is true. The statement would need to be "Three numbers are right but placed wrong" only to satisfy mastermind's rules.
Statement d - none of the numbers in 062 are in the stated wrong numbers.
Statement e - 0 is in the wrong place.

Example reasoning:

Starting with rules a and d. We know from rule d that 8 is not in the solution. So possible options to satisfy the statements a and d are:
[?][?]2 and 6[?][?]
---
With rule d and e we know that 7 and 8 are not in the solution and 0 is in the wrong place. So possible solutions for statements e and d:
0[?][?] and [?]0[?]
---
Combining both of the previous steps (both of them must be true) there are 4 possible ways to make the variations by combining the options. For statements a, d and e:
[?][?]2 and 0[?][?] --> 0[?]2
[?][?]2 and [?]0[?] --> [?]02
6[?][?] and 0[?][?] --> both options can not be true, so this is not valid
6[?][?] and [?]0[?] --> 60[?]
---
Describing applying the statements b and c to the three variations (0[?]2, [?]02 and 60[?]) simultaneously would get confusing, so I will do it one by one. I will start with applying c first because it is a more thoroughly defining rule.
---
Applying statements b and c to 0[?]2
Statement c is satisfied regardless of the value of [?], so it can still be anything. Options are still 0[?]2.
According to statement b one of the numbers in b has to be in the solution, but it is in the wrong position. So it can not be the second digit (1), that means, either 6 or 4 has to be in the solution. Which leaves only two options 062 and 042.
---
Applying statements b and c to [?]02
Applying statement c leaves us with only one option. Since 0 would be in the correct position the second number in the wrong position has to be 6. 602 is the only number that fits. Statement b rules 602 out as a possibility because there are no correct numbers in the wrong position. No solutions from [?]02 fit all the statements.
---
Applying statements b and c to 60[?]
For statement c similarly to the previous case, 0 would be in the correct place. So the out of place correct number has to be 2. The only number that fits is 602. That is the same number as in the previous case, so it is ruled out by rule b. No solutions from 60[?] fit all the statements.
---
Conclusion: There are two equally valid solutions for this puzzle as depicted in the picture without any qualifiers that it should adhere to mastermind rules.

• Please provide some evidence that a version of this game exists where "two numbers..." could mean "at least two numbers..." rather than "exactly two numbers..." – Daniel Mathias Apr 14 at 11:08
• Daniel Mathias, I do not see how the existance of such a game is relevant here. Nothing in the question implies that it is part of some game. Do you want me to justify why the statement " 206 Two numbers are correct but wrong placed" when compared to 062 is true? If you would have to say, no ifs or buts, whether the statement is true or false, what would you say? If it needs to be explained further why that statement is true, I would try to find some good examples from group theory, discrete mathematics or general logic not from a game manual. – MRFalcon Apr 14 at 18:31
• I understand your point about general logic, but taken in the context of this puzzle, "two numbers" should be understood as "exactly two numbers". If the solution was 062, the clue for 206 would necessarily indicate that three numbers were correct. – Daniel Mathias Apr 14 at 18:49
• I'm sorry, I have to disagree. What exactly in the context of this puzzle implies that "two numbers" should be understood as "exactly two numbers". – MRFalcon Apr 14 at 18:55