This is the game Bulls and Cows. The game will pick a random 4 digit number with each digit being 1 to 9. No repeated numbers are allowed. (i.e. the game won't pick a number like 3345.) You will enter guesses until you've correctly identified the number. Invalid guesses will be discarded. Reasons your guess will be discarded are: 1) Guess is longer or shorter than 4 characters 2) Guess contains characters other than 1 through 9 3) Guess contains repeated value such as 1454 (this guess contains duplicate 4s.) If a digit of your guess matches a digit of the game's number and is in the correct position, you will get a bull. If a digit of the your guess matches a digit in the game's number but is in the wrong position, you will get a cow. Use these clues to identify the correct number in as few guesses as possible.
Description of the game can be found here: https://en.wikipedia.org/wiki/Bulls_and_Cows Examples of the game in other programming languages can be found here: http://rosettacode.org/wiki/Bulls_and_cows