Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Successfully reported this slideshow.

Like this document? Why not share!

No Downloads

Total views

930

On SlideShare

0

From Embeds

0

Number of Embeds

2

Shares

0

Downloads

5

Comments

5

Likes

1

No notes for slide

- 1. TUTORIAL ON MASTERMIND CODEBREAKING STRATEGY (1)(THE SIMPLEST GAME SETTING)
- 2. Game Setting: No. of colours: 7; Start from: Trial 1; Length of code: 4; Hintscontain error(s)?: No error; Order type: Fixed order; Colour repeated?: NorepetitionCode: 1345In the beginning we can input any 4 digits. Suppose we input 0123 and the hint is 2(i.e. we get 2 digits correct). In order to trace our reasoning procedure effectively, aTrace Table will be given below. The Trace Table will include such information asthe Codebreakers input, hint obtained, the new digits used in each round of guessand the digit(s) assumed to be correct among the new digits used in a particularround of guess. At the end of the 1st Round, we get the following Trace Table:Round Input Hint New Digits Used in this Round Digit(s) Assumed to be Correct 1 0123 2 0123 -Then we enter the 2nd Round. At first we review the guess result in the 1st Round.As we got 2 digits correct in the 1st Round, we may assume those 2 digits to be 01.In addition, we also need two new digits 45. After inputting 0145, the hint is 3.Thus at the end of the 2nd Round, the Trace Table becomes:Round Input Hint New Digits Used in this Round Digit(s) Assumed to be Correct 1 0123 2 0123 01 2 0145 3 45 -Next we enter the 3rd Round and review our guess result in the 2nd Round first. Asin the 2nd Round we got one more correct digit as compared with the 1st Round,we assume that this correct digit is 4. As we now assume that the correct digits are014, we still need one new digit 6. After inputting 0146, the hint is 2. Thus at theend of the 3rd Round, the Trace Table becomes:Round Input Hint New Digits Used in this Round Digit(s) Assumed to be Correct 1 0123 2 0123 01 2 0145 3 45 4 3 0146 2 6 -Next we enter the 4th Round and review our guess result in the 3rd Round first.Since in the 3rd Round we previously assumed that 014 were the correct digits butthe hint we got was 2, this shows that our previous assumptions are incorrect. Sowe must go back to modify our assumptions. We first go back to the 2nd Roundand change the "Digit(s) Assumed to be Correct" to 5. This means that we nowassume the correct digits to be 015. Having modified our assumption, we proceedforward again and consider the guess result of the 3rd Round. Comparing 015 with
- 3. our guess in the 3rd Round - 0146, we get the following conclusion: if the Codereally contains 015, then our guess 0146 in the 3rd Round should contain at least 2correct digits. As a matter of fact, the hint for the 3rd Round is exactly 2. Thatmeans the new digit 6 used in the 3rd Round is not included in the Code. But if thiswere the case, there would be no more new digits for us to use (according to theGame Setting, the no. of colours for this game is 7, represented by 0,1...6,respectively). This shows that our previous assumptions are incorrect and so wemust go back to modify our assumptions again.We first return to the 2nd Round. As the digit(s) assumed to be correct in the 2ndRound is now 5, which is already the last possible correct digit and thusunchangeable. So we move on to the 1st Round. The digit(s) assumed to be corectin the 1st Round is 01, which is changeable, and so we change it to 02. Next weproceed forward again. First we come to the 2nd Round. Comparing 02 and ourguess in that Round - 0145, we get the following conclusion: if the Code reallycontains 02, then our guess 0145 in the 2nd Round should contain at least 1 correctdigit. As a matter of fact, the hint for the 2nd Round is 3, which is 2 more thanwhat we expected. Thus these two digits must be 45. Next we proceed onward tothe 3rd Round. Comparing 0245 with our guess in that Round - 0146, we get thefollowing conclusion: if the Code is really 0245, then our guess 0146 in the 3rdRound should contain 2 correct digits. And in fact the hint for the 3rd Round isexactly 2, which does not contradict our assumptions. Moreover, as our assumedCode 0245 now contains 4 digits, no more new digits are needed, this is areasonable guess. We next input 0245 and the hint is 2. Thus at the end of the 4thRound, the Trace Table becomes:Round Input Hint New Digits Used in this Round Digit(s) Assumed to be Correct 1 0123 2 0123 02 2 0145 3 45 45 3 0146 2 6 - 4 0245 2 - -Next we enter the 5th Round and review our guess result in the 4th Round first. Aswe assumed the correct digits to be 0245 in the 4th Round but our hint was only 2,this means our previous assumptions are incorrect and so we need to go back tomodify our previous assumptions. First we return to the 3rd Round. Since there isno digit assumed to be correct in the 3rd Round, we move on to the 2nd Round. Asthe digit(s) assumed to be correct in the 2nd Round is 45, which is unchangeable,we further move on to the 1st Round and change the digit(s) assumed to be correctin the 1st Round to 03. Having done this, we proceed forward again. We first cometo the 2nd Round. Comparing 03 and our guess in that Round - 0145, we get thefollowing conclusion: if the Code really contains 03, then our guess 0145 in the2nd Round should contain at least 1 correct digit. As a matter of fact, the hint forthe 2nd Round is 3, which is 2 more than what we expected. So these two digits
- 4. must be 45. Next we proceed to the 3rd Round. Comparing 0345 with our guess inthat Round - 0146, we get the following conclusion: if the Code is really 0345,then our guess 0146 in the 3rd Round should contain 2 correct digits. And in factthe hint for the 3rd Round is esactly 2, which is consistent with our assumptions.Next we proceed to the 4th Round. Comparing 0345 with our guess in that Round -0245, we get the following conclusion: if the Code is really 0345, then we shouldget at least 3 correct digits in the 4th Round. But in fact the hint for the 4th Roundis 2, which is 1 less than what we expected. This means that our previousassumptions are incorrect and so we must go back again to modify our previousassumptions.As shown in the last paragraph, the digit(s) assumed to be correct in the 3rd and2nd Rounds are unchangeable. Thus we must go back to the 1st Round and changethe digit(s) assumed to be correct in the 1st Round to 12. Then we proceed forwardto the 2nd Round again. Comparing 12 and 0145, we conclude that if the Codereally contains 12, then we should get at least 1 correct digit in the 2nd Round. Asthe hint for the 2nd Round is 3, which is 2 more than what we expected, these twodigits must be 45. Next we proceed onward to the 3rd Round. Comparing 1245 and0146, we conclude that if the Code is really 1245, then we should get 2 correctdigits in the 3rd Round. As the hint for the 3rd Round is exactly 2, this is consistentwith our assumptions. Next we proceed onward to the 4th Round. Comparing 1245and 0245, we conclude that if the Code is really 1245, then we should get 3 correctdigits in the 4th Round. But the hint for the 4th Round is 2, which is contradictorywith our assumptions. This shows that our previous assumptions are still incorrectand so we must go back once again to modify our previous assumptions.We return to the 1st Round once again and change the digit(s) assumed to correctin that Round to 13. Next we proceed forward again to the 2nd Round. Comparing13 and 0145, we conclude that if the Code really contains 13, then we should get atleast 1 correct digit in the 2nd Round. As the hint for the 2nd Round is 3, which is2 more than what we expected, these two digits must be 45. Next we proceedonward to the 3rd Round. Comparing 1345 with 0146, we conclude that if theCode is really 1345, then we should get 2 correct digits in the 3rd Round. As thehint for the 3rd Round is exactly 2, this is consistent with our assumptions. Nextwe proceed onward to the 4th Round. Comparing 1345 and 0245, we conclude thatif the Code is really 1345, we should get 2 correct digits in the 4th Round. As thehint for the 4th Round is exactly 2, this is again consistent with our assumptions.Now our assumed Code 1345 is consistent with the hints for the 1st to the 4thRounds and contains exactly 4 digits. Next we input 1345 and as result, we win thegame. At the end of the 5th Round, our Trace Table becomes:Round Input Hint New Digits Used in this Round Digit(s) Assumed to be Correct 1 0123 2 0123 13 2 0145 3 45 45
- 5. 3 0146 2 6 - 4 0245 2 - - 5 1345 WIN - -To summarize, the strategy I introduce here for breaking Mastermind Codes is arepetitive process of making assumptions and modifying assumptions according tothe hints. Our assumptions are made in stages. We conjecture which new digit(s)used in each Round may be included in the Code according to the guess result (i.e.hint) of that particular Round. Whenever we find that our assumptions areincorrect, we go back to modify our previous assumptions. As our strategy is toavoid any omission in our reasoning, we make the least possible modification eachtime, i.e. we try to move just one step back to the previous Round and modify theassumption made in that Round wherever possible. But if the assumption made inthe previous Round is unchangeable, we cannot but move one more step back untilwe find a changeable assumption. After modifying our assumption, we mustproceed onward again to check if our new assumptions contradict the guess resultof the next Round. If so, this means that our new assumptions are still incorrect andwe must go back again to make further modification to our assumptions. If not,then we continue to proceed forward until we prove that our new assumptions areconsistent with all the guess results. By that time we can then input our new guess.In short, in the process of making guesses we repetitively move backward andforward to review the guess results currently available and do our best to make useof any hints already at hand as well as avoid omitting any possibilties. Go toMastermind Link Page.

No public clipboards found for this slide

Login to see the comments