## MASTERMIND

play a game

 The object of the game Mastermind is to deduce a hidden code represented by a series of colored balls. Typically there are four balls in the code. When you start a game, the hidden code will be created from a pool of six colors, which of course means that some possible colors will not end up in the code. Also, the code may contain more than one ball of the same color. In fact, they could all be the same color, e.g., four red balls. Play begins by you guessing what the code might be. Once you have decided on four balls as your guess, they are compared to the hidden code. Order matters. That is, when it comes time to compare, the sequence red, blue, green, black does not match blue, red, black, green. Even though you have all of the right colors, they are in the wrong order. After your guess is compared with the hidden code, you'll get a hint about how well you chose your balls. Balls whose color matches a color in the code, but which are in the wrong order get a white dot. Balls which are the right color in the right order get a black dot. Unfortunately, you won't know which dots correspond to which balls. Is it the red ball or the black one that is in the right place? For example, say the code is red, blue, green, black and you've guessed blue, red, green, yellow. What hint would you get? The blue ball is in the wrong spot, but there is a blue ball in the code, so it would give you a white dot. Likewise for your red ball (giving us two white dots). The green ball is the right color in the right spot: a perfect match, giving you one black dot. There are no yellow balls in the code, so you would receive neither dot for that one. All in all, you would get a hint like this: two white dots and one black one, although the game will not tell you which balls correspond to which dots. These hints will allow you to figure out what the code must be. But don't waste guesses. You only have 10 tries to get it right.