This is a two player variant of the popular game Mastermind. Each player creates a color code and the first one who solves the opponent's code wins the game.
Start position and game object
When a game is started, players must define their color combination (code) of 5 colors. They can choose from 8 different colors and the same color can be used more times. The following picture shows the code editor:
After the codes of both players are created, the initial game board appears:
The left half of the board contains your own code (at the bottom) and opponent's moves. The right half is for your moves and the opponent's code is hidden under the black area (at the top).
How to make moves
As the previous picture shows, there is a row of 8 available colors to pick from to make a guess of the opponent's code. A player clicks on a selected color, then on a blank space at the current guessing row (the first available from the board bottom). When all 5 columns in the guessing row are filled, the player submits the move.
In order to keep the chances of both players balanced, no matter who starts the game, the result of a guess is not shown until both players finish the current turn. It means that after the black player submits the move, the results are displayed simultaneously and with the following rules:
Black peg - the player has guessed the color and the position.
White peg - the player has guessed the color only, the position is elsewhere.
The pegs are displayed from the left to the right, black ones first. Their order is not related to the order of opponent's code colors.
How to finish the game
The game is finished when one or both codes are solved. Since the results of moves are determined at the same time, it is possible that both players solve the opponent's code at the same turn. In this case, the game is a draw. Otherwise, if one player solves the code, he wins the game.
If all rows are used and nobody solves the code, the game is a draw. Play this game