Bulls and Cows
Main Concept

Bulls and Cows is an old paperandpencil game for two players that involves codebreaking.
How To Play:
•

On a sheet of paper, each player writes a 4digit secret number, with no repeated digits, which they must not let their opponent see.

•

The players take turns trying to guess each other's secret number. After each guess, their opponent provides feedback about the number of matches: if they guess a correct digit in the correct position, it is called a "bull," while if they match a digit but in the wrong position, it is called a "cow."

For example, if your opponent's secret number is "1854" and you guess "4879," the feedback you will receive is: 1 bull and 1 cow ("8" is the bull, and "4" is the cow).
•

The first person to reveal their opponent's secret number wins the game.

It is possible to play with secret numbers with 3 to 6 digits, but 4 digits is the most common.
The demonstration below allows you to play a game of Bulls and Cows against the computer.



Click "New Game" to begin a new game. The computer randomly chooses a secret 4digit code, which you attempt to break. Use the dropdown menus below to choose the 4 digits of your guess, then click "Enter Guess" to receive feedback from the computer and learn how many bulls and cows you have. Remember that the code and your guesses must not contain repeated digits.
You will have 15 attempts to break the code before the computer is declared the winner.




Download Help Document
Was this information helpful?