(GAME STARTED FROM MIDDLE)

## Readers are advised to read "Tutorial on Mastermind Codebreaking Strategy (1)" before reading this webpage so that he / she may have a general understanding of the basic principles of Mastermind Codebreaking. |

*Game Setting: No. of colours: 7; Start from: Middle; Length of code: 4; Hints contain
error(s)?: No error; Order type: Fixed order; Colour repeated?: No repetition
Code: 0236
*

Under such a game setting, the computer will first randomly generate the guess results for the first few Rounds. Then you are to continue guessing based on the given results and hints. Since the guess results randomly generated by the computer do not necessarily follow a given numerical order, caution must be exercised in determining the "New Digits Used in this Round". But apart from this, the reasoning principle of this example is no different from other examples. Now let me illustrate this strategy with the following example.

Suppose in the beginning the computer randomly generated the guess results for the first four Rounds as shown in the following table. To distinguish the guess results randomly generated by the computer from the guess results we make subsequently, a # sign is added in front of each guess result given in the following table. In addition, the following table also shows the new digits used in each Round.

Round | Input | Hint | New Digits Used in this Round | Digit(s) Assumed to be Correct |
---|---|---|---|---|

1 | #1346 | 2 | 1346 | - |

2 | #1256 | 2 | 25 | - |

3 | #0136 | 3 | 0 | - |

4 | #1234 | 2 | - | - |

Then we carry out some reasoning based on the given information to determine our input for the 5th Round. Let's start from the 1st Round. Since we got 2 correct digits in the 1st Round, we first assume that these two digits are 13. Then we proceed to the 2nd Round. Comparing 13 and 1256, we conclude that if the Code really contains 13, then we should get at least 1 correct digit in the 2nd Round. The hint for the 2nd Round is 2, which is 1 more than what we expected. We assume that this digit is 2. Next we proceed to the 3rd Round. At this time we assume that the Code contains 123. Comparing 123 and 0136, we conclude that if the Code really contains 123, then we should get at least 2 correct digits in the 3rd Round. The hint for the 3rd Round is 3, which is 1 more than what we expected. We assume that this digit is 0. So far our reasoning proceeds smoothly and our Trace Table becomes:

Round | Input | Hint | New Digits Used in this Round | Digit(s) Assumed to be Correct |
---|---|---|---|---|

1 | #1346 | 2 | 1346 | 13 |

2 | #1256 | 2 | 25 | 2 |

3 | #0136 | 3 | 0 | 0 |

4 | #1234 | 2 | - | - |

Next we proceed onward to the 4th Round. At this time we assume that the Code is 0123. Comparing 0123 and 1234, we conclude that if the Code is really 0123, then we should get 3 correct digits in the 4th Round. But the hint for the 4th Round is 2, which is less than what we expected. This shows shta our assumptions are incorrect and so we must go back to modify our previous assumptions. We first return to the 2nd Round and change the assumption to 5 and then proceed to the 3rd Round again. Comparing 135 and 0136, we conclude that if the Code really contains 135, then we should get at least 2 correct digits in the 3rd Round. The hint for that Round is 3, which is one more than what we expected. So this digit must be 0. Next we proceed onward to the 4th Round. Comparing 0135 and 1234, we conclude that if the Code is really 1234, then we should get 2 correct digits. The hint for that Round is exactly 2, which is consistent with our assumptions. Since we now assume that the correct digits are 0135, which contains exactly 4 digits, we input 0135 in the 5th Round and the hint we get is 2. Thus our Trace Table becomes:

Round | Input | Hint | New Digits Used in this Round | Digit(s) Assumed to be Correct |
---|---|---|---|---|

1 | #1346 | 2 | 1346 | 13 |

2 | #1256 | 2 | 25 | 5 |

3 | #0136 | 3 | 0 | 0 |

4 | #1234 | 2 | - | - |

5 | 0135 | 2 | - | - |

Then we enter the 6th Round and review our guess result in the 5th Round first. As we assumed in
the 5th Round that the correct digits were 0135 and the hint we got was 2, this shows that our
assumptions are incorrect and so we must go back to modify our previous assumptions. We return to
the 1st Round and change the assumption to 14 and then proceed forward to the 2nd Round again.
Comparing 14 and 1256, we conclude that if the Code really contains 14, then we should get at
least 1 correct digit in the 2nd Round. The hint for that Round is 2, which is one more than what
we expected. We assume that this digit is 2. Next we proceed onward to the 3rd Round. At this
time we assume that the Code contains 124. Comparing 124 and 0136, we conclude that if the Code
really contains 124, then we should get at least 1 correct digit in the 3rd Round. The hint for
that Round is 3, which is two more than what we expected. But in the 3rd Round there is only one
new digit (0) available for use. This shows that our assumptions are incorrect and so we must go
back to modify our previous assumptions. However, the problem persists even if we change the
assumption for the 2nd Round to 5 (the readers are asked to prove this by themselves). Therefore
we must return to the 1st Round and modify the assumption for that Round.

It is easy to prove that no matter whether we change the assumption for the 1st Round to 16 or
34, it contradicts the guess result for the 2nd Round (the readers are asked to prove this by
themselves). So we change the assumption for the 1st Round to 36 and then proceed to the 2nd
Round. Comparing 36 and 1256, we conclude that if the Code really contains 36, then we should get
at least 1 correct digit in the 2nd Round. As the hint for the 2nd Round is 2, which is one more
than what we expected, we assume that this digit is 2. Next we proceed onward to the 3rd Round.
At this time we assume that the Code contains 236. Comparing 236 and 0136, we conclude that if
the Code really contains 236, then we should get at least 2 correct digits in the 3rd Round. As
the hint for this Round is 3, which is one more than what we expected, this digit must be 0. Next
we compare 0236 with 1234 of the 4th Round and 0135 of the 5th Round. We will find that the guess
results for these two Rounds are consistent with our assumptions. As we now assume that the
correct digits are 0236, which contains exactly 4 digits, we may input 0236 as our next guess. As
a result we break the Code. Thus at the end of the 6th Round, our Trace Table becomes:

Round | Input | Hint | New Digits Used in this Round | Digit(s) Assumed to be Correct |
---|---|---|---|---|

1 | #1346 | 2 | 1346 | 36 |

2 | #1256 | 2 | 25 | 2 |

3 | #0136 | 3 | 0 | 0 |

4 | #1234 | 2 | - | - |

5 | 0135 | 2 | - | - |

6 | 0236 | WIN | - | - |

From this example, we can see that when we play from the middle of the game, it first seems that the game is not under our control (because the guess results for the first few Rounds are randomly generated by the computer). But in fact the randomly generated guess results often provide much information for us to break the Code and we are often able to break the Code just by making one or two more guesses. This example also shows that when we make guesses, the digits we use need not follow a given numerical order. Even if the digits are ordered randomly, we must be be able to break the Code provided that we make our guesses in a systematic way.