The game

Mastermind (https://en.wikipedia.org/wiki/Mastermind_(board_game)) is an old game. The plastic version ubiquitous in every house with children was invented in 1970. I got a board around 1980 as a Christmas gift, and a program for solving the game puzzle in the BASIC language was one of the first programs that I created, in around 1984.

The game board contains holes in several rows in four columns. There are plastic pins of six different colors that can be inserted into the holes. Each pin has one color. They are usually red, green, blue, yellow, black, and white. There is a special row that is hidden from one of the players (the guesser).

To play the game, one of the players (hider) has to select four pins from a set of pins. The ...

Get Java Projects - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.