Bulls and cows

by Yulia M


It is Bulls and Cows game. The numerical version of the game is usually played with 4 digits. Computer generates a random number, making sure its digits don't repeat. A player tries to guess the secret number, typing in his guess. Computer checking all given digits for matches. If the matching digits are in their right positions, they are "bulls", if in different positions, they are "cows". Example: Secret number: 4271 Player's try: 1234 Answer: 1 bull and 2 cows. (The bull is "2", the cows are "4" and "1".)