Can you crack it? - 3 Digit Code Lock

PM your answer to me. I will post who gets it right.

3 Likes

yes, I can crack it. :winky:

coothead

PM your answers. Dont post it here.

Really? :rofl:
I did not think that it would pose that much
of a problem for the coders around here. :eek:

coothead

If you post it here and you are right there is no point in anyone else figuring it out.

I never actually thought about posting a solution,
but just assumed that an answer to the question…

“Can you crack it?”

…was what you required. :winky:

coothead

Speaking like a computer, eh?

1 Like

Maybe this will help some folks:

<?php declare(strict_types=1);
error_reporting(-1);
ini_set('display_errors', 'true');

function fred($val)
{
    foreach($val as $num) :
      echo ' &nbsp; ' .$num;;
    endforeach;    
    echo '<br>';
}

$x1 = [6, 8, 2, ' - one correct and well placed ']; // 
$x2 = [6, 1, 4, ' - one correct and wrong placed'];
$x3 = [2, 0, 6, ' - two correct and wrongly placed'];
$x4 = [7, 3, 8, ' - none correct'];
$x5 = [3, 8, 0, ' - one correct and wrong placed'];

fred($x1);
fred($x2);
fred($x3);
fred($x4);
fred($x5);

Output:

Edit:

Spelling not my forty :frowning:

How is that going to help when you got the numbers wrong?

1 Like

I found it easier to validate my attempts by having the following test at the start:

$x0 = [1, 2, 3, ' - attempt 001']; //

I have no idea what you are doing and there is no 380.

1 Like

I found it easier to find the solution when the hints were nicely line up on the screen.

Whoops - it should have been “7 8 0”.

Congratulations to @m_hutley for being the first one to get it right.

John - This cant be correct if “7 3 8” 's result is “Nothing is correct.”

He meant the numbers in the last hint box.

1 Like

Ohh. Right. I’m awake. It’s not 3 AM. Shhhhhh. :stuck_out_tongue:

1 Like

Cant be doing too bad, you are the only one to get it right.

Let me know if you “close” this at some point, @benanamen, and i’ll come back and give my way of figuring it out (Which is NOT saying that it’s the only way. Just how my mental gymnastics worked). In a spoiler block, of course.

You can tell me in PM if you like. I am interested to know how you did it.

John Betong cheated and used google to find the answer.

1 Like