The Game of Mastermind
Mastermind is a game of skill, in which two
players engage in a battle of wits and logic. One
of the players is called the Codemaker,
and this player chooses, then hides, a secret code,
which the other player, who is called the
Codebreaker, must attempt to discover.
A move in the game of Mastermind consists
of the following two steps:
The idea is that each successive score will give the Codebreaker more information about the hidden secret code, so that successive guesses become more and more "educated", until the identity of the secret code is determined. Generally, the Codebreaker is limited to a fixed number of guesses. There may be a penalty if the Codebreaker fails to guess the secret code before this fixed number of guesses is exceeded and/or a bonus if the correct guess is made within a certain (small) number of guesses. There may also be a penalty (and perhaps a forfeit of, or a replay of, the game) if the Codemaker is found to have given the wrong information by scoring incorrectly.
There are many variations of the game. A standard one is to conduct a match, in which the players agree in advance to exchange the roles of Codemaker and Codebreaker for a given (even) number of games. The winner is the player with the smaller total number of guesses, or the larger total number if each pointthat is, each guess madeis "awarded" to the Codemaker, rather than "charged" to the Codebreaker. In such a match, if there is a game in which the Codebreaker fails to guess the secret code within the maximum number of guesses permitted, the number of points for that game might be counted as one more than the maximum number of guesses allowed (as one simple example of a possible penalty scheme).
In the original Mastermind board game, the necessary equipment
included the following:
The Codemaker sits at the end of the board containing the special row, and begins by choosing colored pegs for the secret code and placing them in the holes of the special row, behind the shield, in any order. The pegs may be all of the same color, all different, or any combination in between. The Codebreaker then chooses colored pegs for the first guess and inserts these pegs into the first of the guess rows at the Codebreaker's end of the board. The Codemaker compares the guess with the hidden secret code and indicates to the Codebreaker the "score" for that guess by inserting the appropriate number of black and/or white pegs into the smaller holes adjacent to the guess row.
To provide the score for the current guess supplied by the
Codebreaker, the Codemaker compares that guess with the
hidden secret code, and determines the following two values:
Note that in determining these two values, the Codemaker must be careful not to count any peg more than once.
The Codemaker then inserts into the smaller holes opposite the current guess row (the row into which the Codebreaker has most recently placed a guess) a number of black pegs equal to the number of exact matches, and a number of white pegs equal to the number of color matches only. There is nothing about the placement of the black and white scoring pegs to indicate which of the guess pegs correspond to which of the secret code pegs. In other words, the positioning of the scoring pegs has no significance, only the number of each color. If neither a black peg nor a white peg is placed in one of the smaller holes, this means that the Codebreaker has used a color not found in the secret code. And, by extension, if no black or white pegs are placed, this means that the secret code contains none of the colors chosen by the Codebreaker.
The number of black pegs, together with the number of white pegs, form the score used by the Codebreaker to assist in making the subsequent guesses, which proceed similarly until the Codebreaker either guesses the secret code, or runs out of guesses. Once played, all pegs remain in place until the end of the current game.
Both players must exercise a certain amount of care, the Codebreaker in guessing, and the Codemaker in scoring.