TUTORIAL ON MASTERMIND CODEBREAKING STRATEGY (3)
(HINTS MAY CONTAIN ERRORS)

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: Trial 1; Length of code: 4; Hints contain error(s)?: May contain error(s); Order type: Fixed order; Colour repeated?: No repetition

Code: 0136


My strategy of breaking Mastermind codes is to make assumptions and then modify the assumptions according to the given hints. If the hints provided by the Codemaker contain errors, it is impossible for us to break the Code because incorrect hints and the correct Code are contradictory to each other (unless our reasoning also goes wrong and we hit the Code coincidentally). But since the number of possible Codes under a particular game setting is a finite number, when the aforesaid process of modification comes to a certain stage, it will exhaust all the possibilities without hitting the Code. At this time we can conclude for certain that the hints provided by the Codemaker contain errors. Now let me illustrate this strategy with the following example.

In the beginning we input any 4 digits. Suppose our input is 0123 and the hint is 3. At the end of the 1st Round, we get the following Trace Table:

RoundInputHintNew Digits Used in this RoundDigit(s) Assumed to be Correct
1012330123-

Then we enter the 2nd Round and review the guess result in the 1st Round first. As we got 3 correct digits in the 1st Round, we first assume that those 3 digits are 012. In addition we need one new digit 4. After inputting 0124, the hint we get is 2. Thus at the end of the 2nd Round, our Trace Table becomes:

RoundInputHintNew Digits Used in this RoundDigit(s) Assumed to be Correct
1012330123012
2012424-

Then we enter the 3rd Round and review our guess result in the 2nd Round first. Since we assumed in the 2nd Round that 012 was correct but the hints we got was 2, this shows that our previous assumption is incorrect. So we must go back to modify our previous assumption. We return to the 1st Round and change the assumption 013. Then we proceed again to the 2nd Round. Comparing 013 and 0124, we conclude that: if the Code really contains 013, then we should get at least 2 correct digits in the 2nd Round. As the hint for that Round is exactly 2, this is consistent with our assumption.

As we now assume that 013 is correct, we need one new digit 5. After inputting 0135, the hint we get should be 3. But now suppose the hint provided by the Codemaker is 2, i.e. the hint contains an error. Let's see what results we get if we continue guessing. At the end of the 3rd Round, our Trace Table becomes:

RoundInputHintNew Digits Used in this RoundDigit(s) Assumed to be Correct
1012330123013
2012424-
3013525-

Then we enter the 4th Round and review our guess result in the 3rd Round first. As we assumed in the 3rd Round that 013 was correct but the hint we got was 2, this shows that our previous assumption is incorrect and so we must go back to modify our previous assumption. We return to the 1st Round and change the assumption to 023, and then proceed to the 2nd Round again. Comparing 023 and 0124, we conclude that: if the Code really contains 023, then we should get at least 2 correct digits in the 2nd Round. Since the hint for that Round is exactly 2, this is consistent with our assumption. Next we proceed onward to the 3rd Round. Comparing 023 and 0135, we conclude that: if the Code really contains 023, then we should get at least 2 correct digits in the 3rd Round. Since the hint for that Round is exactly 2, this is also consistent with our assumption. As we now assume that 023 is correct, we need one new digit 6. After inputting 0236, the hint we get is 3. Thus at the end of the 4th Round, our Trace Table becomes:

RoundInputHintNew Digits Used in this RoundDigit(s) Assumed to be Correct
1012330123023
2012424-
3013525-
4023636-

Then we enter the 5th Round and review our guess result in the 4th Round first. As we assumed in the 4th Round that 023 was correct and the hint we got was exactly 3, there is now two possibilities: either our assumption is correct or it is incorrect. If our assumption is correct, then 6 is not included in the Code. But then there is no new digit to fill the remaining vacant position (the number of colours under this game setting is 7). That means our assumption must be incorrect. So we have to return to the 1st Round and change the assumption to 123. Now the readers are asked to prove that our new assumption 123 is consistent with the guess results in the 2nd and 3rd Round. Next we proceed onward to the 4th Round. Comparing 123 and 0236, we conclude that: if the Code really contains 123, then we should get at least 2 correct digits in the 4th Round. Yet the hint for that Round is 3, which is one more than what we expected. This digit must be 6. As we now assume that 1236 is correct and that contains exactly 4 digits, we thus input 1236. The hint we get is 3. Thus at the end of the 5th Round, our Trace Table becomes:

RoundInputHintNew Digits Used in this RoundDigit(s) Assumed to be Correct
1012330123123
2012424-
3013525-
40236366
512363--

Next 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 1236 and the hint we got was 3, this shows that our assumptions are incorrect. So we must go back to modify our previous assumptions. We first return to the 4th Round. As there is only one possible correct digit in that Round (6), there is no way for us to modify it. So we can only return to the 1st Round. But our assumption in the 1st Round, 123, is already the last possible combination of correct digits in that Round and so there is no way to modify it. Now we have exhausted all possibilities without hitting the Code. At this time we can conclude for certain that the hints provided by the Codemaker must contain error(s). (However, just based on the aforesaid reasoning, we cannot decide for certain how many errors there are and in which stage the error(s) was / were made.)


Link to Mastermind Link Page.