Mastermind or Master Mind is a code-breaking game for two players, in this case, for a player and the computer. The modern game with pegs was invented in 1970 by Mordecai Meirowitz, an Israeli postmaster and telecommunications expert. It resembles an earlier pencil and paper game called Bulls and Cows that may date back a century.
The codebreaker tries to guess the pattern, in both order and color, within eight to twelve turns. Each guess is made by placing a row of code pegs on the decoding board. Once placed, the codemaker provides feedback by placing from zero to five key pegs in the small holes of the row with the guess. A black key peg is placed for each code peg from the guess which is correct in both color and position. A grey key peg indicates the existence of a correct color code peg placed in the wrong position. A white key peg indicates the color doesn't exist inside the code.