The game of Mastermind

The aim of this game is to guess the hidden pattern of coloured pegs in as few rows as possible. You do this by placing four pegs in a row on the board. For each row you fill, the computer compares your guess with the hidden pattern and gives you a "score".

To start, click on the "New Game" button and then press one of the keys: r,g,y,o,b,w to select a colour. Repeat until a row is filled with four colours. At this stage, the program will report a score for your guess. The score consists of black pegs (right colour in right position), and white pegs (right colour in wrong position).

As soon as you've filled in a row, you can start entering colours for the next row. You win if the program displays four black pegs. You lose if it takes you more than eight guesses.

You need to enable Java to use this applet!


View the source code here.

Anthony Dunk