I. Mastermind

MASTERMIND


Playing the Game

The game is played by typing the number corresponding to the color you would like to guess. The list is as follows:

1. Red

2. Green

3. Blue

4. Yellow

5. Purple

6. Pink

7. Orange

8. Turquoise

The same color will not be used twice and if you try to guess the same color twice the game will not let you. The game will then display your guess on the board in the left column in the row of the guess (e.g. for the first set of guesses the pegs will be in row one). The game will also show to the right of that a number of white pegs and black pegs depending on your guess. For every color you guessed correctly and in the correct spot, there will be a black peg. For every color you guessed correctly but in the incorrect spot, there will be a white peg. This is demonstrated in the picture below:

In this example, the player guessed that the code was red, green, blue, yellow. This was guessed by typing “1 <enter> 2 <enter> 3 <enter> 4 <enter>.” The guess had one color correct and in the correct place, represented by the black peg, and one color correct and in the incorrect place, represented by the white peg. (The actual code in this case turned out to be green, orange, turquoise, yellow, so the black peg was from having yellow correct and the white peg was from having green in the wrong place).

The game continues like this for ten turns or until the game is won, whichever comes first.


Winning the Game

The game is won when the player guesses the code correctly. This will be represented by four black pegs and will be accompanied by the message “You won!” printed to the console.


Illegal Moves

There are moves that cannot be done in the game. For example, it is illegal to guess that a color appears twice in the code. The other illegal move would be guessing things that aren’t numbers 1-8. It is unclear why someone would do this but just don’t.