|Ivars Peterson's MathTrek|
October 11, 1999
For Mathew Mitchell of the School of Education at the University of San Francisco, the preferred training ground is a classic game called Mastermind. "Students young and old are fascinated by simple yet challenging games," he writes in his new book Mastermind Mathematics. Mastermind involves hypothesis testing and deductive reasoning, he notes. It is also an activity that many people find highly enjoyable.
In Mastermind, a codemaker secretly selects a sequence of four colors, typically represented by colored pegs. The codemaker can use any combination of colors picked from the six different colors that are available, including two or more of the same color.
A player's goal is to determine the codemaker's hidden sequence, making as few guesses as possible. With each guess, the player displays a sequence of four colored pegs, and the codemaker indicates how many of those pegs are the correct color and in the right position and how many more are the correct color but in the wrong position.
Suppose the pegs are red (R), blue (B), yellow (Y), green (G), white (W), and orange (O).
|Codemaker's secret sequence:||R||W||B||G|
|Player's first guess:||W||Y||B||O|
In this example, the codemaker would indicate that the player has one peg of the right color in the right position and one peg of the right color in the wrong position but would give no clue that the blue peg (B) and the white peg (W) are the relevant choices.
With six colors and four positions, a codemaker can select from 64 (or 1,296) possible combinations. One useful beginning strategy for a player is to find the colors first, then determine the correct positions. By focusing initially on color, you have only 126 possible groupings to consider. Once you have the colors, you need look at no more than 24 possible arrangements of that set of colors.
Once in a while, however, you might find that you need to know one or two positions before you can work out all the colors. "This brings up an important point about strategies," Mitchell remarks. "They do not always work."
Here's one example where position information helps you out.
|Guess 1:||W||R||O||O||Three pegs are the right color and in the right position.|
|Guess 2:||W||B||B||B||One peg is the right color but is in the wrong position.|
Can you deduce the secret sequence?
Foundation strategies such as pursuing subgoals (such as colors first, then positions), making charts, using deductive reasoning, and eliminating possibilities can serve as powerful tools for quickly working out Mastermind codes. Try solving this one.
|Guess 1:||G||B||B||B||One peg is the right color and in the right position.|
|Guess 2:||O||B||W||W||Nothing is correct.|
|Guess 3:||Y||R||Y||R||One peg is the right color and in the right position; one more is the right color.|
|Guess 4:||Y||B||Y||Y||One peg is the right color but in the wrong position.|
|Guess 5:||O||B||O||R||One peg is the right color and in the right position.|
Mitchell also presents a number of strategies applicable specifically to Mastermind. "You can glean a great deal of information from patterns," he asserts. Certain peg positions and color combinations often offer important clues.
Spotting particular game patterns can help you solve codes. Consider the following pair of guesses.
|Guess 1:||B||O||R||G||Two pegs are the right color.|
|Guess 2:||B||O||R||W||Three pegs are the right color.|
The only difference between the rows is the color in the fourth position. Yet, according to the feedback from the codemaker, a third peg now has the right color. From that change, you can readily deduce that W is the correct color and G is incorrect. In general, Mitchell notes, if two rows differ by only one color and the number of feedback pegs changes from one row to the next, then it must be the one changed color that caused the increase (or decrease) in response.
Try out your pattern-searching strategies on the following game.
|Guess 1:||G||B||R||B||One peg is the right color but in the wrong position.|
|Guess 2:||B||G||B||Y||One peg is the right color and in the right position; one more is the right color.|
|Guess 3:||R||Y||B||R||One peg is the right color but in the wrong position.|
|Guess 4:||O||W||G||Y||One peg is the right color and in the right position; two more are the right color.|
|Guess 5:||O||G||Y||O||Three pegs are the right color and in the right position.|
There's much more in Mitchell's book, all the way up to formal proofs. Indeed, it's amazing how much mathematical activity you can get out of playing Mastermind over and over again. And if the standard version isn't challenging enough, you can always increase the number of colors and the number of slots.
One more thing. The book's many sample game situations give you something to work on when no one happens to be around to set the secret codes for you.
Copyright 1999 by Ivars Peterson
Mitchell, M. 1999. MASTERMIND ® Mathematics: Logic, Strategies, and Proofs. Berkeley, Calif.: Key Curriculum Press. (See http://www.keypress.com/product_info/mastermind.html.)
You can play Mastermind on the Web at http://www.lizardpoint.com/fun/mastermind/mastmind.html.
Official Mastermind Website
MASTERMIND ® is a registered trademark of Pressman Toy Corporation, New York, NY 10010, under an agreement with Invicta Toys and Games Ltd.
Comments are welcome. Please send messages to Ivars Peterson at email@example.com.