IPC Critical Thinking Workshop
Playing MasterMind Better
Why Difficult? | Playing Well | Playing Badly | Playing Well & Badly | Conclusion

 
Why Is MasterMind So Hard?
The rules for MasterMind are fairly simple, but playing the game can get pretty frustrating, even when your concentration isn't undermined by doubts about the reliability of the clue pegs
         MasterMind is hard for two reasons. First, there are so many possible codes that it's practically impossible to get it right just by guessing. Even on the "Easy" level, there are 1,296 possible combinations of code pegs. That means that if you didn't stop to think about the clues, but made a different guess every three seconds, it would take you over an hour to cover every possible code. But if you didn't run out of patience you'd certainly run out of space: on the "Easy" level you get only twelve rows for guesses. On the "Master" level it's even worse: there are over a quarter of a million possible codes, and you have only 20 guesses.

MasterMind's Exponential Increase In Difficulty
Skill LevelColoursHolesCodesMax. Guesses
Idiot2244
Simple43648
Easy64129612
Medium84409614
Hard8532,76816
Master86262,14420
# of possible codes = (colours)(holes)
 
Playing MasterMind Well
If you want to play MasterMind successfully, you have to learn to get the most out of every clue, and you have to be able to combine the information from different clues to learn more than any one of them gives on its own. This is the second reason the game is hard: it's hard to fix the information from each of the clues in your mind long enough to work out what they mean. This takes more than just a good short-term memory. It takes close attention to the clues, and a systematic analysis of what they mean. The best way to learn to do these is to practice describing in different ways what each clue tells you, and then pick a colour and systematically work through each of the possible combinations of colour pegs until you either have a guess that is consistent with the clue pegs from your previous guesses or you've discovered it is impossible for that coloured peg to be in the code.
 
Playing MasterMind Badly
A sure-fire recipe for frustration is to flit back and forth between one colour and another, never fully exploring one possibility before abandoning it for another --- "I'm not having much luck with the Green, maybe I'll try Blue.... hmm, that's not any easier, let me try the Red... still nothing, maybe the Green again..." and on, and on and on. While in principle this haphazard approach could work just as well as the more systematic, in practice it won't because it makes it much harder to keep track of which combinations of pegs you've tried and ruled out, so you're much more likely to waste time repeating yourself. And what could be more frustrating than that?
 
Playing MasterMind Well and Badly: An Example
Enough background. Here's an example from the "Simple" setting. The notes describe one way to think through these problems, there are others.

MasterMind A1 A1. The first guess could be any combination of pegs. In A1 the guess is (R B B), and the clue is one black. From this we know that the code has either a R or a B but not both (otherwise there would have been more than one clue peg); and that there is at most one B, but there could be more than one R.

MasterMind A2 A2. Hmm. Even before laying them down the player could have known that (Y G G) couldn't possibly be the code, since A1 tells us there must be a R or B in the code. So, in a way this guess was wasted, since there was no way it could be right. Even so, we can learn a lot from the clue pegs in A2. Just like A1, the single clue peg in A2 tells us that the code has either a Y or a G but not both, and that there is at most one G, but there could be more than one Y.
         Now we really have to start thinking. We don't want to waste any more turns with guesses that couldn't possibly be right. At this point I usually try to be systematic about it, by picking one colour and working through every possible combination of codes with that colour. If I can find a combination with that colour which fits with the previous clues, then I'll make that my guess. If there aren't any combinations with that colour, I'll move on to the next colour. You can begin this process of elimination with any colour you want. In this example, I'll pick Green.
         A2 tells us that if G is in the code, then it must appear in column 1. [Note: To make describing this more concise, I'll use a letter-number pair to describe the position of any peg; so G1 will mean there is a Green peg in the first column.] If G1, then it's not possible that the R peg in the first row is in the right position, so if G1 then A1 tells us that B2 or B3. So, if G1 then the code must be either (G B ?) or (G ? B). Which peg should we put in the empty space? [Stop and think here]
         We know it can't be a second Green peg, since A2 tells us there's only one G in the code. It can't be a Y, since A2 also tells us that there is a G or a Y but not both. It can't be a Blue, since A1 tells us there is at most one B in the code. And there are two reasons it can't be a Red: 1) A1 tells us there can't be both an R and B in the code, and 2) A1 tells us that if there are any R in the code, there must be one in the first column, and that's where the Green peg is.
         What all this means is that there can't be a Green in the code. It's impossible. We've thought through every possible way to put a Green peg in a guess and found that there's no way to do it that is consistent with the clue pegs. So Green is ruled out.
         Since Green is ruled out, the white clue peg in A2 must refer to the Y; so we know that the code will be either: (? Y ?) or (? ? Y) or (? Y Y). Now let's work through every possible combination with a Yellow peg. Can there be a Y and a B? If Y is in the code, A2 tells us it is either Y2 or Y3 (or both) and G is not in the code. If B is in the code, A1 tells us that it must be either B2 or B3, and R is not in the code. So what goes in column 1? Nothing fits. So Y and B cannot both be in the code.
         What do we know so far? We know Green is not in the code. We know that since Green is not in the code, Yellow must be in the code (A2). We know that Yellow and Blue are not both in the code, but since Yellow is definitely in the code, there can't be any Blue. And since there can't be any Blue, there must be at least one Red (A1). So there must be both Red and Yellow in the code, and only Red and Yellow.
         Now let's think about Red. We know there's at least one R in the code, and A1 tells us that this Red is definitely in column 1. That leaves us with three possible guesses: (R Y Y), (R R Y), or (R Y R). Based on what we know, any of these three could be the answer, so we're back to guessing. I guessed (R Y Y).

MasterMind A3 A3 Rats. I know I had only a one in three chance of guessing right, but this guess doesn't seem to have helped me much. After A2 (and a lot of hard thinking), I'd narrowed it down to three possible codes. I guessed wrong, but it turns out the clue from my guess still leaves me with two possible codes: (R R Y) or (R Y R). Compare that with how much I learned from my first two guesses. Was there a different guess for the third row that would have told me more?

MasterMind A4 A4. Yeah! In Yo face, computa! Don't be disrespecting me on my planet.

Ahem.

I hope we've all learned a valuable lesson here.


 
Valuable Lesson(s)

  • This is not the only way to think through these problems, there are others. If you have found a different way to solve MasterMind that works both consistently and well, use it.
  • The game involves both guessing and hard reasoning. Begin by guessing, use the answer to each guess to deductively narrow down the range of possible codes, and make a more informed guess the next time. Not unlike scientific investigation.
  • MasterMind develops concentration: obviously.
  • MasterMind requires perserverance: most of your guesses will be wrong.
  • MasterMind encourages a mindfully systematic approach: you have almost no chance of guessing the right answer, and a haphazard approach will waste too much time and effort. Take a step-by-step approach, and keep track of what you've done so far and what you're doing now.
Introducing... | Playing... | Playing Better... | Download... MasterMind

Copyright © 1998-2002 John Upper


InkWire? email John (the instructor)
johnupper@sympatico.ca
Copyright © 2002