HOME

TheInfoList



OR:

''Mastermind'' or ''Master Mind'' () is a
code In communications and information processing, code is a system of rules to convert information—such as a letter, word, sound, image, or gesture—into another form, sometimes shortened or secret, for communication through a communicati ...
-breaking game for two players invented in
Israel Israel, officially the State of Israel, is a country in West Asia. It Borders of Israel, shares borders with Lebanon to the north, Syria to the north-east, Jordan to the east, Egypt to the south-west, and the Mediterranean Sea to the west. Isr ...
. It resembles an earlier pencil and paper game called Bulls and Cows that may date back a century.


History

Mastermind was invented in 1970 by Mordecai Meirowitz, an
Israel Israel, officially the State of Israel, is a country in West Asia. It Borders of Israel, shares borders with Lebanon to the north, Syria to the north-east, Jordan to the east, Egypt to the south-west, and the Mediterranean Sea to the west. Isr ...
i postmaster and telecommunications expert. After presenting the idea to major toy companies and showing it at the Nuremberg International Toy Fair, it was picked up by a plastics company, Invicta Plastics, based near
Leicester Leicester ( ) is a city status in the United Kingdom, city, Unitary authorities of England, unitary authority area, and the county town of Leicestershire in the East Midlands of England. It is the largest city in the East Midlands with a popula ...
, UK. Invicta purchased all the rights to the game, and the founder, Edward Jones-Fenleigh, refined the game further. It was released in 1971–2. The game is based on a paper and pencil game called Bulls and Cows. A computer adaptation was run in the 1960s on
Cambridge University The University of Cambridge is a Public university, public collegiate university, collegiate research university in Cambridge, England. Founded in 1209, the University of Cambridge is the List of oldest universities in continuous operation, wo ...
’s
Titan Titan most often refers to: * Titan (moon), the largest moon of Saturn * Titans, a race of deities in Greek mythology Titan or Titans may also refer to: Arts and entertainment Fictional entities Fictional locations * Titan in fiction, fictiona ...
computer system, where it was called 'MOO'. This version was written by Frank King. Other versions were written for the TSS/8 time sharing system by J.S. Felton, for
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
by
Ken Thompson Kenneth Lane Thompson (born February 4, 1943) is an American pioneer of computer science. Thompson worked at Bell Labs for most of his career where he designed and implemented the original Unix operating system. He also invented the B (programmi ...
, and for the
Multics Multics ("MULTiplexed Information and Computing Service") is an influential early time-sharing operating system based on the concept of a single-level memory.Dennis M. Ritchie, "The Evolution of the Unix Time-sharing System", Communications of t ...
system at
MIT The Massachusetts Institute of Technology (MIT) is a private research university in Cambridge, Massachusetts, United States. Established in 1861, MIT has played a significant role in the development of many areas of modern technology and sc ...
by Jerrold Grochow. Since 1971, the rights to ''Mastermind'' have been held by Invicta Plastics. (Invicta always called the game ''Master Mind''.) They originally manufactured it themselves, though they have since licensed its manufacture to
Hasbro Hasbro, Inc. (; a syllabic abbreviation of its original name, Hassenfeld Brothers) is an American multinational corporation, multinational toy manufacturing and entertainment holding company founded on December 6, 1923 by Henry, Hillel and Herma ...
worldwide, with the exception of Pressman Toys and Orda Industries who have the manufacturing rights to the United States and Israel, respectively. Chieftain Products acquired the rights to manufacture in Canada in 1972, though they went out of business in 1996. Starting in 1973, the game box featured a photograph of a man in a suit jacket seated in the foreground, with a young woman standing behind him. The two amateur models (Bill Woodward and Cecilia Fung) reunited in June 2003 to pose for another publicity photo. In 2025, toy company Goliath entered a multi-year agreement with Hasbro to become the worldwide manufacturer and distributor of the Mastermind brand.


Gameplay and rules

The game is played using: * a ''decoding board'', with a ''shield'' at one end covering a row of four large holes, and twelve (or ten, or eight, or six) additional rows containing four large holes next to a set of four small holes; * ''code pegs'' of six different colors (or more; see Variations below), with round heads, which will be placed in the large holes on the board; and * ''key pegs'', some colored red (or black) and some white, which are flat-headed and smaller than the code pegs; they will be placed in the small holes on the board. The two players decide in advance how many games they will play, which must be an
even number In mathematics, parity is the property of an integer of whether it is even or odd. An integer is even if it is divisible by 2, and odd if it is not.. For example, −4, 0, and 82 are even numbers, while −3, 5, 23, and 69 are odd numbers. The ...
. One player becomes the ''codemaker'', the other the ''codebreaker''. The codemaker chooses a pattern of four code pegs. Players decide in advance whether duplicates and blanks are allowed. If so, the codemaker may choose up to four same-colored code pegs or four blanks. If blanks are not allowed in the code, the codebreaker may not use blanks in their guesses. The codemaker places the chosen pattern in the four holes covered by the shield, visible to the codemaker but not to the codebreaker. The codebreaker tries to deduce the pattern, in both order and color, within eight to twelve turns. Each attempt is made by placing a row of code pegs on the decoding board. Once placed, the codemaker provides feedback by placing from zero to four key pegs in the small holes of the row with the guess. A colored key peg is placed for each code peg from the guess which is correct in both color and position. A white key peg indicates a code peg that belongs in the solution, but is incorrectly positioned. If there are duplicate colors in the guess, they cannot all be awarded a key peg unless they correspond to the same number of duplicate colors in the hidden code. For example, if the hidden code is red-red-blue-blue and the codebreaker places red-red-red-blue, the codemaker will award three colored key pegs for the first two reds and the blue, but nothing for the third red. No indication is given of the fact that the code also includes a second blue. Once feedback is provided, another attempt is made; tests and feedback continue to alternate until either the codebreaker deduces correctly, or all rows on the decoding board are full. Traditionally, players can only earn points when playing as the codemaker. The codemaker gets one point for each guess the codebreaker makes. An extra point is earned by the codemaker if the codebreaker is unable to deduce the exact pattern within the given number of turns. (An alternative is to score based on the number of key pegs placed.) The winner is the one who has the most points after the agreed-upon number of games are played. Other rules may be specified.


Algorithms and strategies

Before asking for a best strategy of the codebreaker one has to define what is the meaning of "best": The minimal number of moves can be analyzed under the conditions of worst and average case and in the sense of a minimax value of a zero-sum game in
game theory Game theory is the study of mathematical models of strategic interactions. It has applications in many fields of social science, and is used extensively in economics, logic, systems science and computer science. Initially, game theory addressed ...
.


Best strategies with four holes and six colors

With four holes and six colors, there are 64 = 1,296 different patterns (allowing duplicate colors but not blanks).


Worst case: Five-guess algorithm

In 1977,
Donald Knuth Donald Ervin Knuth ( ; born January 10, 1938) is an American computer scientist and mathematician. He is a professor emeritus at Stanford University. He is the 1974 recipient of the ACM Turing Award, informally considered the Nobel Prize of comp ...
demonstrated that the codebreaker can solve the pattern in five moves or fewer, using an algorithm that progressively reduces the number of possible patterns. Described using the numbers 1–6 to represent the six colors of the code pegs, the algorithm works as follows: # Create the set of 1,296 possible codes . # Start with initial guess 1122. (Knuth gives examples showing that this algorithm using first guesses other than "two pair"; such as 1111, 1112, 1123, or 1234; does not win in five tries on every code.) # Play the guess to get a response of colored and white key pegs. # If the response is four colored key pegs, the game is won, the algorithm terminates. # Otherwise, remove from any code that would not give that response of colored and white pegs. # The next guess is chosen by the
minimax Minimax (sometimes Minmax, MM or saddle point) is a decision rule used in artificial intelligence, decision theory, combinatorial game theory, statistics, and philosophy for ''minimizing'' the possible loss function, loss for a Worst-case scenari ...
technique, which chooses a guess that has the least worst response score. In this case, a response to a guess is some number of colored and white key pegs, and the ''score of a response'' is defined to be the number of codes in that are still possible even after the response is known. The ''score of a guess'' is pessimistically defined to be the worst (maximum) of all its response scores. From the set of guesses with the best (minimum) guess score, select one as the next guess, choosing a code from whenever possible. (Within these constraints, Knuth follows the convention of choosing the guess with the least numeric value; e.g., 2345 is lower than 3456. Knuth also gives an example showing that in some cases no code from will be among the best scoring guesses and thus the guess cannot win on the next turn, yet will be necessary to assure a win in five.) # Repeat from step 3.


Average case

Subsequent mathematicians have been finding various algorithms that reduce the average number of turns needed to solve the pattern: in 1993, Kenji Koyama and Tony W. Lai performed an exhaustive
depth-first search Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node (selecting some arbitrary node as the root node in the case of a graph) and explores as far as possible al ...
showing that the optimal method for solving a random code could achieve an average of turns to solve, with a worst-case scenario of six turns.


Minimax value of game theory

The minimax value in the sense of game theory is The minimax strategy of the codemaker consists in a uniformly distributed selection of one of the 1,290 patterns with two or more colors.


Genetic algorithm

A new algorithm with an embedded
genetic algorithm In computer science and operations research, a genetic algorithm (GA) is a metaheuristic inspired by the process of natural selection that belongs to the larger class of evolutionary algorithms (EA). Genetic algorithms are commonly used to g ...
, where a large set of eligible codes is collected throughout the different generations. The quality of each of these codes is determined based on a comparison with a selection of elements of the eligible set. This algorithm is based on a heuristic that assigns a score to each eligible combination based on its probability of actually being the hidden combination. Since this combination is not known, the score is based on characteristics of the set of eligible solutions or the sample of them found by the evolutionary algorithm. The algorithm works as follows, with ''P'' = length of the solution used in the game, ''X''1 = exact matches ("red pins") and ''Y''1 = near matches ("white pins"): # Set ''i'' = 1 # Play fixed initial guess ''G''1 # Get the response ''X''1 and ''Y''1 # Repeat while ''Xi'' ≠ ''P'': ## Increment ''i'' ## Set ''Ei'' =
In mathematics, the empty set or void set is the unique set having no elements; its size or cardinality (count of elements in a set) is zero. Some axiomatic set theories ensure that the empty set exists by including an axiom of empty set, wh ...
and ''h'' = 1 ## Initialize population ## Repeat while ''h'' ≤ ''maxgen'' and , ''Ei'', ≤ ''maxsize'': ### Generate new population using crossover, mutation, inversion and permutation ### Calculate fitness ### Add eligible combinations to ''Ei'' ### Increment ''h'' ## Play guess ''Gi'' which belongs to ''Ei'' ## Get response ''Xi'' and ''Yi''


Complexity and the satisfiability problem

In November 2004, Michiel de Bondt proved that solving a ''Mastermind'' board is an
NP-complete In computational complexity theory, NP-complete problems are the hardest of the problems to which ''solutions'' can be verified ''quickly''. Somewhat more precisely, a problem is NP-complete when: # It is a decision problem, meaning that for any ...
problem when played with ''n'' pegs per row and two colors, by showing how to represent any one-in-three 3SAT problem in it. He also showed the same for ''Consistent Mastermind'' (playing the game so that every guess is a candidate for the secret code that is consistent with the hints in the previous guesses). The ''Mastermind satisfiability problem'' (MSP) is a
decision problem In computability theory and computational complexity theory, a decision problem is a computational problem that can be posed as a yes–no question on a set of input values. An example of a decision problem is deciding whether a given natura ...
that asks, "Given a set of guesses and the number of colored and white key pegs scored for each guess, is there at least one secret pattern that generates those exact scores?" (If not, then the codemaker must have incorrectly scored at least one guess.) In December 2005, Jeff Stuckman and Guo-Qiang Zhang showed in an
arXiv arXiv (pronounced as "archive"—the X represents the Chi (letter), Greek letter chi ⟨χ⟩) is an open-access repository of electronic preprints and postprints (known as e-prints) approved for posting after moderation, but not Scholarly pee ...
article that MSP is NP-complete.


Variations

Varying the number of colors and the number of holes results in a spectrum of ''Mastermind'' games of different levels of difficulty. Another common variation is to support different numbers of players taking on the roles of codemaker and codebreaker. The following are some examples of ''Mastermind'' games produced by Invicta,
Parker Brothers Parker Brothers (known as Parker outside of North America) was an American toy and game manufacturer which in 1991 became a brand of Hasbro. More than 1,800 games were published under the Parker Brothers name since 1883. It remained family owne ...
, Pressman,
Hasbro Hasbro, Inc. (; a syllabic abbreviation of its original name, Hassenfeld Brothers) is an American multinational corporation, multinational toy manufacturing and entertainment holding company founded on December 6, 1923 by Henry, Hillel and Herma ...
, and other game manufacturers: There was also a version called ''Super Code'' produced in
East Germany East Germany, officially known as the German Democratic Republic (GDR), was a country in Central Europe from Foundation of East Germany, its formation on 7 October 1949 until German reunification, its reunification with West Germany (FRG) on ...
by VEB Plasticart. The difficulty level of any of the above can be increased by treating “empty” as an additional color or decreased by requiring only that the code's colors be guessed, independent of position. In ''Mini Mastermind'' the colored code pegs are the same size and shape as the colored or white key pegs so the difficulty can be increased by permitting the key pegs to be used as code pegs for two additional colors. Computer and Internet versions of the game have also been made, sometimes with variations in the number and type of pieces involved and often under different names to avoid trademark infringement. ''Mastermind'' can also be played with paper and pencil. There is a numeral variety of the Mastermind in which a 4-digit number is guessed. The 2021 web game ''
Wordle ''Wordle'' is a web-based word game created and developed by the Welsh software engineer Josh Wardle. In the game, players have six attempts to guess a five-letter word, receiving feedback through colored tiles that indicate correct letters a ...
'' has been compared to ''Mastermind''; however, in ''Wordle'' a response to a guess indicates which letters (corresponding to code pegs) are correctly placed or incorrectly placed, whereas in ''Mastermind'' only the count of correctly and incorrectly placed code pegs are indicated. The game was included in the compilation party video game '' Clubhouse Games: 51 Worldwide Classics'' for the
Nintendo Switch The is a video game console developed by Nintendo and released worldwide in most regions on March 3, 2017. Released in the middle of the Eighth generation of video game consoles, eighth generation of home consoles, the Switch succeeded the ...
under the name "Hit & Blow".


Reviews

*''
Games A game is a Structure, structured type of play (activity), play usually undertaken for entertainment or fun, and sometimes used as an Educational game, educational tool. Many games are also considered to be Work (human activity), work (such as p ...
'' #3 *''Games and Puzzles'' *1980 Games 100 in ''
Games A game is a Structure, structured type of play (activity), play usually undertaken for entertainment or fun, and sometimes used as an Educational game, educational tool. Many games are also considered to be Work (human activity), work (such as p ...
''
1981 Games 100
in ''
Games A game is a Structure, structured type of play (activity), play usually undertaken for entertainment or fun, and sometimes used as an Educational game, educational tool. Many games are also considered to be Work (human activity), work (such as p ...
'' *'' Games & Puzzles'' *'' The Playboy Winner's Guide to Board Games'' *''Family Games: The 100 Best''


See also

* Israeli inventions and discoveries * Bulls and Cows and AB – similar games with numbers * Jotto – a similar pen and paper word game for two players * Lingo – a similar TV show *
Wordle ''Wordle'' is a web-based word game created and developed by the Welsh software engineer Josh Wardle. In the game, players have six attempts to guess a five-letter word, receiving feedback through colored tiles that indicate correct letters a ...
– a similar 2021 web game


Explanatory notes


References


External links


Mastermind: An augment reality approach, Porting a Legacy Game to New Interaction Paradigm



Optimal Solution Look-Up Table on ''Mastermind''
{{DEFAULTSORT:Mastermind (Board Game) Board games introduced in 1970 1970s toys Abstract strategy games Games of mental skill Logic puzzles NP-complete problems Deduction board games Parker Brothers games Pressman Toy Corporation games Guessing games Israeli games ru:Быки и коровы