Introduction Rules of the colour game
Homepage
  Fore note: this game requires JavaScript and DynamicHTML. Please make sure your browser has JavaScript enabled.

1. Summary
2. How to play
3. Rules
4. Examples
5. High scores
6. Notes
7. Mastermind

1. Summary

The goal of the colour game is to discover a combination of of coloured pegs selected by the computer at random. This game is a variant of Mastermind.

At each turn, the player chooses a combination of coloured pegs and the computer returns one black dot for each peg on the right position and one white dot for each peg present in the combination in a different position.

Then the player chooses a different combination, adding pegs of other colours, switching the order of the coloured pegs, or both.

The game continues until the combination is found or the maximum number of turns is reached.

The colour game offers three levels of increasing difficulty. From level I to level III, the number of pegs and the number of possible colours increase and also the maximum number of turns.

Table 1: game features on each level
  number of pegs number of colours number of turns
level I 4 6 6
level II 5 7 8
level III 6 8 10

1. Summary
2. How to play
3. Rules
4. Examples
5. High scores
6. Notes
7. Mastermind

2. How to play

2.1. The game board

An example of the level I board is shown on the right.

The board shows the key pegs on the top; these will be hidden until the end of the game.

The game progresses from top to bottom, one turn on each row. In this example, the two rows under the key show the first and second turns and the next row shows the undefined pegs for the third turn.

The column on the right shows the results for each turn.

example, level I
   
   
   

2.2. The game sequence

Each turn is composed of five steps:

  1. To select one coloured peg, the player clicks one of the circles and chooses the desired colour from the table of colours. When a colour is selected (clicked), the circle is replaced by a peg of the desired colour.
  2. In case of mistake, it is possible to choose a different colour, selecting the wrong peg and choosing a new colour.
  3. The process is repeated until all the circles are filled with coloured pegs. At this moment, the symbol appears on the right column.
  4. When the player is satisfied with the proposed combination, the player clicks on the symbol. Otherwise, one can correct the peg sequence until the desired combination is attained. Only then the turn is validated, by clicking on .
  5. The computer evaluates the combination and returns an answer: one black dot for each peg that coincides with the peg on the secret key and one white dot for each peg contained in the secret key in a different position. The order of the dots is arbitrary.

If the player hits the key - the number of the black dots is equal to the number of pegs -, the game ends. The key is revealed on top and a green flagis shown on the right.

If the combination is not correct and there are empty turns to play, a new row with the symbols appears below the last one.

If the maximum number of turns is reached before the key is discovered, the player looses. The key is revealed on top and a red flagis shown on the right.

At any instant during the game, if the player clicks an invalid point a yellow warning flagappears on the top right corner of the board.

The command "Quit the game" terminates the game at any moment, revealing the key.

The command "jogar de novo . play again . jouer à nouveau" starts a new game at the same level. To choose a different level, one should return to the Introduction. To choose a different game one should return to the homepage.

 
1. Summary
2. How to play
3. Rules
4. Examples
5. High scores
6. Notes
7. Mastermind

3. Rules of the game

The key is a combination of N coloured pegs, chosen from a set of possible colours P, with or without repetition.

Each turn is formed by a combination of N coloured pegs, chosen from a set of possible colours P, with or without repetition.

On Table 1 the values for N and P are shown for the three levels of the game.

After each turn, the computer compares the proposed combination with the key:

  1. For each position on the player's turn, from 1 to N, the peg on the turn is compared with the peg in the key at the same position. In case they match, the computer puts a black mark on the right column.
  2. For each position on the current turn - from 1 to N - that does not match a peg at the same position in the key (thus, it does not correspond to a black mark), a peg with the same colour in any other position of the key is searched, even if it had been matched with a previous peg in the player's turn. The computer indicates such occurrence with a white mark.
  3. The order of black and white marks on the right column is arbitrary.

The difference between the colour game and the Mastermind is limited to the second rule, which defines the coding of the white marks. In the colour game the two first rules may be merged in one rule, and the rule set may be rewritten as:

  1. For each coloured peg in the player's turn, from 1 to N, the key is searched for a peg of the same colour. If a peg of the same colour is found at the same position, a black mark is shown, whereas a match with a peg of the same colour in a different position is indicated by a white mark.
  2. The order of black and white marks on the right column is arbitrary.
 
1. Summary
2. How to play
3. Rules
4. Examples
5. High scores
6. Notes
7. Mastermind

4. Examples

The illustration of the game is based on Level I examples but the translation to other levels is straightforward.

In addition to the illustration of the rules, a crude explanation of a possible reasoning is offered.

The sorting of pegs is from left to right: first peg on the left, forth peg on the right.

 

4.1. Example of rule application and deduction of the hidden key

Let's assume the following hidden key:

Let's assume the first two turns are as illustrated on the right.

Given the key and the turns chosen by the player the computer determines the following:

  1. On the first turn, the first peg of the turn matches the second peg of the key (white mark), the second peg of the turn matches the second peg of the key (black mark) and the third peg of the turn also matches the second peg of the key, denoted by a second white mark.
  2. On the second turn, the first peg of the turn matches the second peg of the key (white mark), the second peg of the turn matches the first peg of the key - or the fourth peg of the key, it's immaterial; the third peg is denoted likewise. Finally, the fourth peg of the turn matches the third peg of the key, which adds a fourth white mark.

The analysis the two turns yields:

  1. From the first line, on concludes there is a red peg between position one and position three. A second red peg could exist at the fourth position. One also concludes there are no blue pegs .
  2. From the second line, one deduces the red peg is not located on the first position of the key. Moreover, one finds there is one or two yellow pegs on the first and/or fourth positions and there are one or two green pegs between position one and position three.

Let's assume the third and fourth turns are played as illustrated on the right.

Given the key and the turns played, the computer determines the following:

  1. On the third turn, the first peg of the turn matches the third peg of the key (white mark), the second peg of the turn matches the same position on the key (black mark),
  2. On the fourth turn, the first peg of the turn matches the third peg of the key (white mark) and the third peg of the turn matches the second peg of the key (white mark).

The analysis of turns three and four , combined with the previous two turns allows the following conclusions:

  1. On the third line, one finds that either the red peg or the green peg are on the correct position, but not both. There are no pink pegs.
  2. On the fourth line, one finds that the green peg is not located at first position and the red peg is not located at third position. In addition, one concludes there are no turquoise pegs .

After four turns, it is certain that only three colours exist on the key: red , green and yellow .

It is also certain that a red peg exists on the second position: from the first turn, one knows that it lies between position one and three, on the second turn position one is excluded and on the fourth turn position three is excluded. This validates one of the assumptions of the third turn.

It is also certain that there are no green pegs on the fourth (second turn) and first positions (third and fourth turns). Since position two is taken, the single green peg must lie at position three.

Finally, one deduces from these exclusions that one yellow peg is located on the first position.

Now, only the fourth position remains undetermined and one already knows that it can't be green .

Let's assume the fifth and sixth turns are played as illustrated on the right.

Given the key and the turns played, the computer determines the following:

  1. On the fifth turn, the first, second and third positions of the turn match the corresponding positions on the key, yielding three black marks. The fourth position of the turn matches the second position of the key (white mark).
  2. On the sixth turn the four pegs of the turn are matched with the corresponding four pegs of the key and the game concludes with successfully.

The analysis of the two turns, combined with the previous four turns returns:

  1. The fifth line confirms the previous deductions about positions one to three. Moreover, one concludes that the fourth peg is not red , so it must be yellow .
  2. On the sixth turn, the key was found.

4.2. Example with deduction of the key

The table on the right shows another example of deduction. The secret key is revealed on the top line.

One possible line of deduction - among the many possible - is presented, leading towards the correct solution:

  1. From the first line, one concludes there is one yellow peg between the first and third positions and there are no turquoise pegs .
  2. From the second line, one concludes that there are one or more green pegsbetween the first and third positions, and one or more yellow pegsbetween the second and fourth positions. There are no blue pegs .
  3. After the third turn, the analysis is performed with pairs of pegs, assuming two pegs are in the correct position - associated with the black marks - and exploring each of the six possible scenarios.
    1. The first and second pegs can't be both correct; otherwise, there would not be room for the red pegs on the third or fourth position.
    2. If the first and third peg were correct, the yellow peg could not be at the second position, which contradicts the first turn.
    3. If the first and fourth pegs are correct, the yellow peg must be on the third position. The solution follows the form , where denotes an undetermined peg.
    4. If the second and third pegs are correct, the Gerona peg must be on the fourth positions, which contradicts the second turn.
    5. If the second and fourth pegs are correct, the green peg must be on the third position. The solution follows the form .
    6. If the third and fourth pegs are correct, the yellow peg must be on the first position, which contradicts the second turn.
  4. On the fourth line, the fifth scenario was assumed (). One finds that the hypothesis is not confirmed and that there is a pink peg .
  5. On the fifth line, the remaining scenario was tested (), replacing the unknown peg with one pink peg . The game ends with the confirmation with the hypothesis.

4.3. Notes

These examples do not intend to "teach you" how to play the colour game. The goal is to illustrate the rules used by the computer and introduce new players of the game into the typical deductive processes that apply to the game and highlight its differences from Mastermind.

There was also a concern to show a limited set of hypotheses to explore to help new players understand the rules.

Like Mastermind, the colour game depends on chance to some extent but depends much more on the player's deductive skills and experience. A seasoned player recognises the patterns of coloured pegs and corresponding black and white marks and deploys the various possibilities without stating them explicitly peg by beg. It should be emphasised that colour game patterns are completely different from the Mastermind patterns.

1. Summary
2. How to play
3. Rules
4. Examples
5. High scores
6. Notes
7. Mastermind

5. High scores

This colour game implementation offers the possibility of storing the high scores reached on each computer. To this purpose, a cookie is stored on the computer disk. This option is only available in case you allow the use of cookies.

It must be emphasised that no information is sent to the server where the game is installed. If you're moving to another browser or to another computer, you will start a new table of high scores.

The high score table stores the number of turns to success, the key, your name and the date.

The procedure is straightforward: upon success, the computer checks your result with the scores on the board. If you have reached a better result, you are invited to write your name - or any message - up to 44 characters. In case you do not want to record you score you may "Close" this option.

When a new score is added to the table, it is shown automatically. To check the current high scores at other times, follow the "High score table" link in the "Introduction" page.

The high score table shows the results for each level. From this page it is possible to start a new game on the same level with "jogar de novo . play again . jouer à nouveau", "Reset high scores" on this level or review the tables for the other levels.

1. Summary
2. How to play
3. Rules
4. Examples
5. High scores
6. Notes
7. Mastermind

6. Notes

  1. The pages of the game initialise a new game each time they are loaded. Thus, using reload or refresh will yield a new game with a different colour key.
    Likewise, if you move to a new page - these rules, for instance - an then returns to the game, you will find a new game. Therefore, if you want to check another page during a game, I suggest you target it to a new page.
  2. You're advised to wait for the complete loading of the images on the page, especially the black and white marks that show the outcome of each turn, before starting a new turn. This is due to traffic slowdown on the net. These problems are overcome after some games since the images are cached.
1. Summary
2. How to play
3. Rules
4. Examples
5. High scores
6. Notes
7. Mastermind

7. Mastermind

The colour game is my personal variation of Mastermind.

The Mastermind rules were changed only in the manner the white pegs (right colour at the wrong location) are computed.

This minor change suffices to change deeply the game algorithms and the deduction patterns. Thus, I advise you not to change too often between the two games to minimise the confusion.

Introduction  
Homepage

I wish you many pleasant moments with the colour game. In case you have any doubts, remarks or suggestions, feel free to contact me. All messages are welcome.

©2001 João Gomes Mota