%-------------------------------------------------------------------------------
% Jaroslav Klima
% Mastermind
%
% Neproceduralni programovani
% Zimni semestr 2005/2006
%-------------------------------------------------------------------------------
 

1) Rules of the game
2) Using the program
3) Playing the codebreaker
4) Playing the codemaker



1) Rules of the game:
---------------------

Mastermind is a game played by two players, the codemaker and the codebreaker. The game begins with the codemaker selecting a code, a sequence of N colors (digits, pegs or other symbols) (c1, c2,...,cN) chosen from a set of C colors (repetitions allowed). The codebreaker will then try to guess the code. After each guess (g1, g2,...,gN), the codemaker responds with two numbers. The first, the number of exact matches, is the number of times cK = gK, (K = 1,...,N). The second, the number of near matches, is the number of colors in the guess which are the right color, but in the wrong position. Each response point refers to one and only one color peg. Evaluation of exact matches has precedence over evaluation of near, or color, matches.
If the codebreaker manages to guess the right sequence before a given number of guesses, he wins, otherwise, he loses.


2) Using the program:
---------------------

To start the program, type 'start.' and press enter. Then follow instructions on the screen. During the run of the program, please make sure that you never enter a single dot when asked for input. This would cause an error and an immediate termination of the program.

The menu:
To select a menu item, locate a number to the left of the item and press the corresponding key.

Settings - menu items 3 to 5:
When asked, enter a value followed by a single dot and press enter. Should the value be invalid, you will be asked to enter a different one.


3) Playing the codebreaker:
---------------------------------------

At the beginning of each turn, you will be asked to enter your guess. You must enter the guess in the form '[g1,g2,..,gN].', otherwise you will be asked to enter it again. For each guess, the computer will return a score in the form '(A,B)', where A is the number of exact matches and B is the number of near matches.


4) Playing the codemaker:
-------------------------------------

At the beginning of each turn, the computer will guess a sequence and write it on the screen in the form '[g1,g2,...,gN]'. You will then be asked to respond with a score in the form '(A,B).', where A is the number of exact matches and B is the number of near matches. Should you enter an invalid score, you will be asked to enter one again. Should you enter a score that is valid, but logically incorrect with respect to the previous turns, you will be asked to restart the program and it will terminate.