View Single Post
Old 2021-06-02, 20:50   #6
Walter
 
"Walter S. Gisler"
Sep 2020
Switzerland

11 Posts
Default

I like your approach, Viliam. I would be really curious to see how it performs in a Monte Carlo simulation, but it isn't as easy to implement as my method.

You can even improve the performance a bit if you keep track of pairings that are wrong. For example, in step 2c, you learn about two numbers that are wrong and it would never make sense to switch either of them back again. In the example that you provided, you are doing one move that could be avoided:

You already know (from the very first step) that 4 can't be in the second position, but you are doing a swap later in the process that brings it back into that position.

By the way, after 8 steps, the solution is actually clear if you combine all of the knowledge you have gained in the process. To show this, I have created a 5x5 grid representing all possible pairs of letters/ envelopes. Whenever your "friend" tells you that a solution has 0 correct choices, you cross out a possible solution.

After the first 8 steps, you got the 0-correct scenario 7 times, so the grid is quite full already (see attached screenshot). Based on this, you can already deduce the correct solution for letter 4 and 5 and don't need to continue trying with those. Furthermore, you have had one solution that gave you 1 correct position:

3, 1, 4, 2, 5

Since from all the 0-correct scenarios you know that the solution will be x, x, x, 4, 5, you can now deduce that 3, 1, 4, 2 is also incorrect. That crosses out one more square and tells you that the solution will be x, x, 3, 4, 5. Furthermore, for position 1, the candidates are either 1 or 4, but 4 is already taken. From that, the whole solution is know.

Nevertheless, a pretty good strategy, but you can combine it with additional logic reasoning to reduce the number of steps.
Attached Thumbnails
Click image for larger version

Name:	after_8_steps.png
Views:	46
Size:	5.8 KB
ID:	25009   Click image for larger version

Name:	after_8_steps_continuation.png
Views:	41
Size:	5.9 KB
ID:	25010  
Walter is offline   Reply With Quote