Question: The bulls and cows game is a code-breaking game designed for two or more players. Each player chooses a secret code of 4 digits from
The bulls and cows game is a code-breaking game designed for two or more players. Each player chooses a secret code of 4 digits from 0 - 9. The digits must be all different. The goal of the game is for each player to guess the other player's secret code.
- The players in turn present their guesses to the opponents. The opponents respond by telling the players:
- The number of bulls, i.e. the number of matching digits in their right positions, and
- The number of cows, i.e. the number of matching digits but in different positions.
Please enter your secret code: 4568 You guess: 1234 Result: 1 bull and 2 cows Computer guess: 5940 Result: bulls and 2 cows You guess: 1345 Result: 0 bulls and 2 cows Computer guess: 1279 Result: bulls and 0 cows You guess: 4271 Result: 3 bulls and cows Computer guess: 4890 Result: 1 bull and 1 cow You guess: 4281 Result: 4 bulls and 0 cows You win! :)
Step by Step Solution
3.38 Rating (151 Votes )
There are 3 Steps involved in it
It seems like youre describing the classic game of Bulls and Cows Players take turns guessing each o... View full answer
Get step-by-step solutions from verified subject matter experts
