This programme is written in Flash MX with ActionScript and may be run on Windows 95 or higher versions of Windows. To cater for the different configurations of different PCs, I have prepared two versions of the programme packed in two different zip files: "" and "". The former occupies a storage space of about 1.6 MB while the latter just about 0.7 MB after being unzipped. The main difference between the two versions is that the former is executable on a usual PC without the need of installing any plug-in programme while the latter can be run only after your PC has isntalled the Shockwave Flash programme. Despite of these, the two versions are essentially the same.


Just run the executable file named "Flash_Matermind.exe" or "Flash_Matermind.swf". You may adjust the size of the screen. In order to hear the background music and sound effects, you should switch on the loudspeaker of your PC.


Please note that in the following discussion, the terms "secret code" and "answer" essentially mean the same thing, and so do the terms "hints" and "marks".

This programme has inherited the game rules of the classical Mastermind game, which was invented by an Israeli telecommunications expert, Mordecai Meirowitz. In this game, the Codemaker thinks of a colour string (the secret code) using any combination of colours in the Colour Panel that conforms to the particular game setting chosen. The Codebreaker will try to duplicate the exact colours and positions of the secret code. Each time the Codebreaker makes a guess, the Codemaker must give information ("hints") by displaying black and white balls. A black ball is displayed for every colour ball which is the same colour and in exactly the same position as one of the colour balls in the secret code. A white ball is displayed for each colour ball which is matched in colour but not position. When the Codebreaker duplicates the secret code, he wins the game. For example, if the code is "1231" and the Codebreaker's guess is "1134" (here the colours are represented by numbers), then the hints will be two black balls and one white ball.


After you start the programme, you will see a Title Page. After a while (or after you click the mouse), the programme will go to the Background Screen. What follows is a detailed introduction to the various features of this screen.

Status Bar

At the bottom of the screen is the Status Bar, which is used for displaying useful messages to prompt the user to take some actions. When you are at a loss for what to do at any moment, read the message in the status bar.


From this menu, you can choose any one of the 1,424 different game settings. There are 9 list boxes and 4 command buttons in this menu. Seven of the list boxes (Who guesses?, Number of Colours, Start from, Length of Code, Hints contain error(s)?, Order Type, Colour repeated?) determine the game setting. The remaining two (Display Mode, Input Method) determine the input / output modes of the game. The following is a description of the options available in each of these list boxes and the functions of the command buttons.

Who guesses?

There are 3 options in this list box: You guess, Computer guesses and Watch computer play. If you choose the first option, you will act as the Codebreaker and will have to break a code generated by the computer. If you choose the second option, you will act as the Codemaker. The computer will then become the Codebreaker to guess a code made by you based on the hints you gave. If you choose the third option, the computer will act as both the Codemaker and the Codebreaker (the computer will be "honest") and you can then watch how the computer plays the game.

Number of Colours

This determines the number of different colours that the secret code may be drawn from, ranging from 5 to 10 colours. The specific colours that may actually be used will be shown in the Colour Panel.

Start from

There are two options in this list box: Trial 1 and Middle. If the former option is chosen, the game will start right from the beginning, just like the usual Mastermind game. If the latter option is chosen, the game will start in the intermediate phase when some initial guesses have already been made. Under this option, if you are playing a You guess game or a Watch computer play game, the computer will generate a number of initial guesses together with the hints. You or the computer will then have to continue guessing based on the initial guesses and hints. On the other hand, if you are playing a Computer guesses game, you will then be prompted to input the trial number at which you want the computer to start guessing (between 2 and 9) as well as the initial guesses together with the hints. Under both cases, the initial guesses and the guesses made subsequently will be shown by different colours in the RECORD Area.

Length of Code

This determines the length of the secret code. The exact length of code falls into two types: specified or unspecified. The former type ranges from 3 to 8 while the latter type ranges from Unspecified (3 - 4) to Unspecified (3 - 8). Unspecified code length means the secret code may contain blank spaces. But please notice blank spaces are not considered as one type of colours and are not counted when giving marks. For example, if the code is "bb345" and the Codebreaker's guess is "b304b", then the hints will be one black ball and one white ball.

Hints contain error(s)?

There are two options in this list box: No error and May contain error(s). If you choose the former, all hints provided by the computer contain no errors, just like the usual game. If you choose the latter, some of the hints may contain error(s) and the game proceeds differently depending on whether you are playing the You guess game or the Watch computer play game.

In the former case, an Error button will appear after the first guess has been made. If you detect that the hints provided are inconsistent, you can press the Error button. The computer will then determine whether the hints given have really led to inconsistencies. If so, all the errors will be corrected and you can then continue guessing until you break the code. If the hints do not lead to inconsistencies or if you detect the inconsistencies too late, you will lose the game. Please notice this game setting is quite demanding of the player: not only do you need to detect the inconsistencies (if any), but you have to detect them "at the right time".

In the latter case, the computer will guess as usual. When it detects an error, a message box will spring up informing you and requesting you to press the OK button. After you press the button, the computer will correct all the error(s) automatically and then continue guessing based on the corrected hints.

Please notice the Computer guesses option and May contain error(s) option are a pair of "excluded combinations". That means you are not allowed to choose these options at the same time. In case you make error(s) when giving hints knowingly or unknowingly, the computer will sooner or later detect the inconsistencies among the hints and will not continue guessing. Amazed at the powerful A.I. of my programme?

Order Type

There are two Order Types: Fixed order and Random order. Under the former option, the colours must be arranged according to the predefined order as shown in the Colour Panel , with the blank spaces placed at the end, while under the latter option, the colours ( including blank spaces) may be arranged in any order.

Colour repeated?

This determines the number of repetitions that a particular colour may be repeated in the code and may range from No repetition, Each colour at most n times to May be repeated any times, with "n" being an integer between 2 and 7.

Display Mode

There are three Display Modes: Both, Colour and Number. The first mode is the combination of the latter two. Under the Colour mode, the computer will display all guesses and codes (answers) using colour balls. On the other hand, under the Number mode, each colour is represented by a digit between 0 and 9, while the blank space is represented by the letter "b". The correspondence between colours and digits is shown in a Colour Panel which will appear in a later stage of the game.

You may change the Display Mode at any stage of the game, or when the computer prompts you to change the mode at the end of a game.

Input Method

There are two Input Methods: Mouse and Keyboard. Under the Mouse method, the player inputs his / her guesses / hints by using the mouse (dragging, clicking). Under the Keyboard method, you input your guesses / hints by keying in numbers, using numbers and "b" to represent colours and blank spaces where appropriate.

Please note that this option only applies to the You guess and Computer guesses games. You may change the Input Method at any stage of the game.

Start Game Button

This command enables you to start a new game with the game setting as specified in the Game Setting Menu. After a new game starts, the programme will go to the Game Playing Screen. (Click HERE for a detailed introduction to the Game Playing Screen .)

Start Demo Button

In addition to playing games, this programme also contains a Demo function. After pressing this button, the programme goes to the Game Playing Screen and you may see how the computer plays the game with itself (without cheating!) endlessly under randomly chosen game settings. The Demo function will also be activated automatically in 5 minutes, displaying a certain kind of "screen saver" effect, if you leave the programme idle without playing any games.

While Demo is on, you may use a scrollbar to adjust the speed of the Demo. To end Demo, just press the End Demo in the Game Playing Screen

On/Off Sound Effect Button

This is a toggle command which enables you to switch on / off the background music and sound effects.

On/Off Animation Button

This is a toggle command which enables you to switch on / off the background animation.


This screen appears after you press the Start Game button or the Start Demo button. In addition to the Status Bar, On/Off Sound Effect Button, and On/Off Animation Button which also appear in this screen, there are some new features. What follows is an introduction to the features in this screen.


The lower half of the screen is the RECORD Area where the previous guesses and hints are shown for your reference.

Game Setting Frame

The upper right part of the screen is the Game Setting Frame which is a table showing the game setting as well as the Game Status of the particular game for your reference.

Colour Panel

The Colour Panel is located in the lower half of the upper left part of the screen. This panel shows you the specific colours that the secret code may be drawn from. The digit corresponding to each colour is also shown on each colour ball.

At the end of a game or during the whole course of a Watch computer play game or when Demo is on, the Colour Panel will appear as an Answer Frame or Possible Answer Frame showing the answer or possible answer of that particular game for your inspection.

Input / Message Area

The Input / Message Area is located in the upper half of the upper left part of the screen. This is the area where you input the information as requested by the computer or the computer shows you some information. The outlook of this area is different depending on the types and stages of the game. At times when the computer shows you the marks of a guess or when the computer requests you to input marks for its guess, the input area will occupy the whole upper half of the screen (and thus cover the Game Setting Frame and the Colour Panel .

Demo Speed Control Scrollbar

This appears in the Input / Message Area during a Demo session. It allows you to adjust the speed of the demo function.

End Game Button

This command enables you to end the game at any stage of the game except when the computer is making a guess or a message box has appeared. Please note that if you are playing under the "You guess" setting and have already made at least one guess, the correct answer of that particular game will be shown in the Answer Frame after you choose this command.

End Demo Button

This command enables you to end the Demo session and return to the Background Screen.

Time Spent Frame

In a "You guess" or "Computer guesses" game, this frame provides the information of the time elapsed since the commencement of the game so that the player is aware of the time left. When the time limit is drawing near (i.e. 55 minutes after the commencement of the game), a warning message will appear to remind the player.


These refer to the various stages of a game. Here is a summary of the various Game Statuses that you may encounter.


This Game Status occurs most often and refers to the normal stage when the Codebreaker is still trying to break the code.


This only occurs in a Computer guesses game when the computer prompts you to think of a string for it to guess or when the computer prompts you to input the initial guesses and hints under the middle game setting.


This occurs when the Codebreaker breaks the code.

Error Detected

This occurs when the Codebreaker correctly detects an inconsistency among the given hints at the right time (i.e. not too early or late). If it is a Computer guesses game, the computer will not continue the game. Otherwise, the error(s) will be corrected and the Codebreaker may then continue playing.

Continue Playing

This occurs after an error has been detected and corrected and the Codebreaker continues playing the game.

End Game

This occurs when you end the game in an intermediate stage of the game.


In a You guess game, you are allowed to guess for a maximum of 18 times (including any initial guesses) within one hour. Failing to break the code within the maximum number of trials or the time limit will lead to Gameover.

Hint(s) consistent

This only occurs in a You guess game under a May contain error(s) setting when you incorrectly determine that there is an error among the given hints but the given hints are in fact consistent. When this occurs, a possible answer (i.e. a string that is consistent with the given hints) will be shown in the Possible Answer Frame.

Late Detection of Error

This only occurs in a You guess game under a May contain error(s) setting when you detect the error too late. The computer will then tell you where the error(s) occur and when you should have detected the error(s).

Go to Mastermind Link Page.