Guess – Mastermind – Puzzle Game


Guess is a clone of the classic, deductive, code-breaking game, Master Mind.



The game was invented by Mordecai Meirowitz in 1970. It achieved widespread popularity in the UK by Invicta Plastics, Ltd.

Master Mind is a 2 player game where one player (the “codemaker”) hides a four colour peg combination, and the other player (the “codebreaker”) seeks to identify all four colour pegs by trying appropriate test patterns. In the standard game, there are 6 different coloured pegs.

With Guess, the game becomes a single player game with the computer taking the role of the “codemaker”. Dark circles indicate the number of matched coloured and placed pegs. A white circle indicates a peg is the correct colour, but in the wrong position. And a grey circle indicates the peg does not match the solution.

In the screenshot to the left, you can see my first attempt (4 red pegs) drew a complete blank – none of the pegs in the solution are red. The second attempt tells us that there are also no yellow pegs in the solution. However, the third attempt (4 green) notifies us there is a green peg in the solution, although we don’t know which position the peg lies. In the next line, we can infer that the green peg does not sit in the first circle, and there are no blue pegs in the solution. The final line tells us the solution contains 2 brown pegs and 1 green peg. We now have sufficient information to deduce the solution has a single purple peg, but we still don’t know whether the green peg sits in the correct position. We need to keep experimenting until the puzzle is solved, but there are only 5 more attempts left.

With the standard 6 colours and 4 places, there are 1296 codewords (6^4) given that repetitions are permitted. But if you want a greater challenge, Guess has a Super mode (the other screenshot). In this variant, there are now 7 coloured pegs, and 5 peg holes. This means there are 16807 codewords (7^5). You do get a couple of more guesses, but this variant is harder to crack the right combination.

There is also a custom mode where you can define the number of colours, pegs per guess, and the number of guesses. You can also allow/disallow blanks and duplicates.

Here is a short video demonstrating Guess (Master Mind), Inertia, Tents, Mines (Minesweeper), and Solo (Sudoku).

In 1976, Donald Knuth, Professor Emeritus of The Art of Computer Programming at Stanford University, and the creator of the TeX computer typesetting system, published an academic paper titled ‘The Computer as Master Mind’. The paper reveals how the codebreaker can always succeed in cracking the code in 5 moves or less. This applies to the standard game mode.

Below is a short tutorial showing you how to download and compile the latest source code for this game, and the other 38 games in the puzzle collection. The tutorial takes place in Linux, using the Ubuntu 17.10 distribution, but the procedure will be the same, or very similar, for other Linux distributions. If you find the tutorial helpful, please give the video a like and subscribe to our YouTube channel.

Besides the main 3 operating system, the puzzle collection has also been ported by contributors to Palm, Android, Symbian 60, iPhone, iPad, and the Windows Store.

Developer: Simon Tatham, Richard Boulton, James Harvey, Mike Pinna, Jonas Kölker, Dariusz Olszewski, Michael Schierl, Lambros Lambrou, Bernd Schmidt, Steffen Bauer, Lennard Sprong, and Rogier Goossens
License: MIT
Written in: C, Java, JavaScript

Back to the Puzzle Collection