Mastermind is a two-player code-breaking game where one player makes a code (in your program this will be the human player) and another player guesses the code (in your program this will be the computer player). Your task is to create a game that allows a human to play against the computer. The computer should be able to guess the correct code (created by the human player). The code is made up of four colors and can include duplicates. There are six available colors from which to choose: red, green, orange, yellow, blue, purple.
-
For the first iteration, the human player (the code-maker) just responds to the computer player with
yes
orno
. The computer has as many chances to guess as they need. -
The next iteration will allow for the human player to respond with number of pegs that are correct (right color in right place) and the number of pegs that are the right color, but the wrong place. e.g.
code | guess | num1 | num2
-----+-------+------+------
RRGR | RRRG | 2 | 2
RRGR | RRRB | 2