Mastermind
Mastermind is a codebreaking game played by two players. The game starts with the first player, who we call "the codemaker", creates a hidden four digits (colors) code. Then the second player, who we call "the codebreaker", guess a code. The codemaker then evaluate the guess by providing the codebreaker with some black and white pins (plus and minus in the paper version). Based on the evaluation, the codebreaker guess another code and game continues untill either the codebreaker finds (or fails to find) the hidden code within a maximum tries.
Game History
"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 or more." (Ref)
Game Rules
- If a digit of the guess code is in the hidden code and on the correct place, a black pin (plus) is put.
- If a digit of the guess code is in the hidden code but not on the correct place, a white pin (minus) is put.
- Every peg in the hidden code and the guess counts only once in the black and white pins.
- If a peg in the guess can be considered as both a black or a white pin, preference is black.
For example, let the hidden code and the guess be "1124" and "1343", respectively. Then the only '1' in the guess can result in a black pin (with the first '1' in the hidden code) or a white pin (with the second '1' in the hidden code). In such a situation, the codemaker must put a black pin not a white. In this example, the codemaker puts one black pin for '1' and one white pin for '4'.
QtMind
QtMind is a free computer clone of the mastermind game written in C++ with the aid of the Qt framework. It is possible to enable/disable same color in codes. You can play codemaker or codebreaker.
Currently there are three solving algorithms in the codemaker game mode in QtMind: Donald Knuth's Worst Case (minimax), Most Parts, and Expected Size. The worst case algorithm finds the hidden code at most in five guesses in the classical game with six colors and four slots. The solving algorithm can be changed in the middle of a game.
The source code is compatible with any version of Qt greater than or equal to four, but to benefit game sound you should compile QtMind against Qt at least five.
The graphical characteristics of QtMind is almost identical to those of ColorCode, another high quality and powerfull clone of the mastermind game, though the coding is different. The result of rewritting is that QtMind is lighter, faster and more efficient than ColorCode. ColorCode only contains an incomplete version of the worst case solving algorithm.
QtMind can be translated to any language. If you are interested, help on how to translate QtMind to your language can be found on the tranlate page.