## INSTRUCTIONS ON PC VERSION MASTERMIND (VISUAL BASIC)

### GENERAL INTRODUCTION

This programme is written in Visual Basic 5 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: "Vbmm1.zip" and "Vbmm2.zip". The former occupies a storage space of about 3.6 MB while the latter just about 0.8 MB after being unzipped. The main difference between the two versions is that the former is equipped with a full range of background music and sound effects (which you can choose to switch off) while the latter does not have these features. There are also some other minor differences between the two versions. Despite of these, the two versions are essentially the same.

### HOW TO RUN THE PROGRAMME?

Just run the executable file named "VB_Mastermind1.exe" or "VB_Mastermind2.exe". Please note that the programme must be run on 800 x 600 resolution or higher. If the resoultion of your monitor is less than 800 x 600, you must adjust the resolution before you can successfully run the programme. In order to hear the background music and sound effects, you should switch on the loudspeaker of your PC (this only applies to "VB_Mastermind1.exe").

### THE GAME

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 boxes. A black box is displayed for every colour box which is the same colour and in exactly the same position as one of the colour boxes in the secret code. A white box is displayed for each colour box 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 boxes and one white box.

### BACKGROUND SCREEN

After you start the programme, you will see a Title Page. After a while, 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.

#### Pull-Down Menus and Short-Cut Command Buttons

Beneath the Title Bar are 4 Pull-Down Menus, namely Game, Multimedia, Options and Help. To see the menu, just click the name of the menu. Alternatively, you may also press ALT + the letter in bracket next to the name of the menu. Inside each menu, there are several commands for you to choose. Just click the name of the command to activate it. Alternatively, you may also press ALT + the letter in bracket next to the name of the menu, or press the function key (F1, F2, etc) on your keyboard. The function keys corresponding to the commands are indicated in the menus. You may also press the Short-Cut Command Buttons beneath the pull-down menus to activate some of the commands. Place your mouse inside the button. After a short while, you will see what commands these buttons stand for. What follows is an introduction of the various commands.

#### Game Menu

In this menu, you can choose 6 commands, namely Game Setting, New Game, Load Game, Save Game, End Game and Quit.

#### Game Setting Command

After choosing this command, the Game Setting Menu will appear for you to choose your preferred game setting. Click HERE for a detailed introduction to the Game Setting Menu.

#### New Game Command

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 .)
If you are playing a Computer guesses game, after you choose the New Game command, you will be prompted to choose whether you want the computer to do the marking for you. If you choose "yes", then you need to input the code for the computer to guess and the computer will guess and mark all by itself. (Trust the computer! It will do the guessing and marking as if there were two players and will not cheat.) If you choose "No", then you need to do the marking by yourself and the computer will prompt you to input marks each time after it has made a guess. Please make sure you input the marks correctly. Incorrect marks will lead to inconsistencies among the hints and will be detected by the computer sooner or later.

#### Load Game Command

This command enables to load a game previously saved. After choosing this command, a dialogue box will appear for you to input the name of the saved game. You may also delete any saved game. Just follow the instructions shown on the dialogue box.

#### Save Game Command

This command is made up of two sub-commands: Save and Save As. In the first time when you save a game, both sub-commands perform the same function - you are prompted to input the name for the game to be saved. After the first saving, when you choose the Save command, the game will be saved under the same game name. In contrast, if you want to save the game under a different name, then you should choose the Save As command which will prompt you to input the name of the game. Please note that when playing under the "You guess" setting, you are not allowed to save the game until you have made at least one guess.
Each time when a code is broken or when you abandon or lose the game, the programme will allow you to save the game for later inspection. Just follow the instructions in the message box that appears.

#### End Game Command

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.

#### Quit Command

This command enables you to quit the programme at any stage of the game except when the computer is making a guess or a message box has appeared.

#### Multimedia Menu

This menu contains 3 commands, namely On/Off Music, On/Off Animation and Start Demo .

#### On/Off Music Command

This is a toggle command which enables you to switch on / off the background music (this command is always disabled in "VB_Mastermind2.exe").

#### On/Off Animation Command

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

#### Start Demo Command

In addition to playing games, this programme also contains a Demo function. After choosing this command, 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 click the Cloud Area in the lower half of the Game Playing Screen

#### Options Menu

This menu contains 2 commands, namely Input Method and Display Mode. Each of these commands contains 2 options for you to choose. After making the choice, the chosen option will be checked.

#### 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, double-clicking, 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.

#### Display Mode

There are two Display Modes: Colour and Number. Under the Colour mode, the computer will display all guesses and codes (answers) using colour boxes. 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.

#### Help Menu

This menu contains 2 commands, namely Brief Instructions and About Mastermind.

#### Brief Instructions

After choosing this command, a Brief Instructions message box will appear giving some brief instructions about the game.

#### About Mastermind

After choosing this command, an About Mastermind message box will appear giving some information about designer and copyright of the programme.

### GAME SETTING MENU

From this menu, you can choose any one of the 1,424 different game settings. There are 7 list boxes and 3 command buttons in this menu. 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 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 box and one white box.

#### 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.

#### Start Game Button

Pressing this button has the same effect as choosing the New Game command under the Game menu.

#### TOP FIVE List Button

This button is only enabled when the You guess option is chosen. In this programme, a TOP FIVE List is provided for each of the 1,494 game settings in honour of the best five players under each game setting. The determination of the TOP FIVE players is based on the time spent and number of attempts made by a player, in that order. After breaking a code, if you are eligible to enter the TOP FIVE List, you will be prompted to input your name which will then be shown in the list. Please note that to prevent cheating, players of any loaded games are not eligible for entering the TOP FIVE List.
In addition to the information about the best five players, the TOP FIVE List also provides some computer statistics about the average number of attempts needed by the computer to break codes under the particular game setting. Some initial statistics have been provided for each newly installed programme and the statistics will be updated whenever you play the "Watch computer play" game or run Demo.
WARNING: The information of the winners are stored in the Winners files under the Winners Subdirectory. DO NOT try to open these files. Otherwise the programme will be damaged and cannot be run any more. You will then have to download and reinstall the programme again.

#### Cancel Button

Pressing this button will close the Game Setting Menu.

### GAME PLAYING SCREEN

This screen appears after you choose the New Game command or the Start Demo command, or press the Start Game button. In addition to the Status Bar, Pull-Down Menus and the Short-Cut Command Buttons which also appear in this screen, there are some new features. What follows is an introduction to the features in this screen.

#### RECORD Area (Cloud Area)

The lower half of the screen is the RECORD Area (Cloud 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 box.
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.

#### 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.

### GAME STATUS

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

#### Playing

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

#### Preparation

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.

#### Win

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.

#### Gameover

In a You guess game, you are allowed to guess for a maximum of 27 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).

### TIMER CONTROL

This programme does not allow the player to leave it idle without doing anything. A number of timers are thus set to force the player to give response within a time limit. Please take notice of the time limits prescribed in the message boxes or the Status Bar.

Go to Mastermind Link Page.