Mastermind is a game played by two players, the codemaker and the codebreaker. The codebreaker will then try to guess the code. The second, the number of near matches, is the number of colors in the guess which are the right color, but in the wrong position. In the applet bellow the number of exact matches is indicated by small red dots, while white dots define the second number. In the real game the codemaker uses small pegs for the same purpose.
Mastermind is a game of deduction.
When only one element remains it is bound to be the secret code. If colors are represented by numbers starting with 0, then 0011 or 0012 are good candidates for the first guess. In other respects too Mastermind relates to the language and body of mathematics. If a guess contains the same color in more than 1 position, but the secret code contains it only once, an interesting situation may arise. Evaluation of exact matches has precedence over evaluation of near, or color, matches.