Bulls and Cows Game: Rules, Scoring and How to Win

Bulls and Cows is a code-breaking game for two players that needs nothing but a pencil and paper. Each player hides a secret number, then you take turns guessing each other’s number. Every guess earns clues: bulls for digits in exactly the right place and cows for digits that are in the number but somewhere else. Using those clues, you narrow the options down until one player cracks the code. It is a great logic game for the classroom, a long car ride or a rainy afternoon, and it is the game that the board game Mastermind is based on.

What you need

  • Two players, or one code holder and a group of guessers.
  • Paper and a pencil for each player.
  • Optional: our Random Number Generator to pick a secret number at random.

How to play Bulls and Cows

  1. Pick a secret number. Each player writes down a four-digit number in which every digit is different, such as 4071 or 2958, and keeps it hidden. A leading zero is allowed unless you agree otherwise.
  2. Decide who goes first. Flip a coin or play a round of Rock Paper Scissors.
  3. Guess. On your turn, say a four-digit number with no repeated digits. Your opponent compares it with their secret number.
  4. Score the guess. Your opponent answers with the number of bulls and the number of cows, for example “one bull, two cows”. They do not say which digits earned them.
  5. Take notes. Write every guess and its score down. The clues only work when you compare them with each other.
  6. Win. The first player to score four bulls has found the secret number and wins.

To keep things fair, many players finish the round: if the first player cracks the code, the second player gets one last guess. If they crack it too, the game is a draw.

How to score bulls and cows

Look at each digit in the guess on its own. If the secret number has that digit in the same position, it is a bull. If the secret number has the digit in a different position, it is a cow. If the digit is not in the secret number at all, it scores nothing.

Say the secret number is 4271:

GuessScoreWhy
12341 bull, 2 cows2 is in the right place; 1 and 4 are in the number but in other places
56890 bulls, 0 cowsnone of these digits is in the number
42172 bulls, 2 cows4 and 2 are right; 1 and 7 have swapped places
42714 bullsthe code is cracked

A score of zero is good news, not bad: it rules out four digits at once. Double-check every answer before you say it, because one wrong score can make the whole game impossible to solve.

What the first guess tells you

With four different digits there are 10 × 9 × 8 × 7 = 5,040 possible secret numbers. The table shows how likely each score is for any first guess, such as 1234.

First-guess scoreChance
0 bulls, 0 cows7.1%
0 bulls, 1 cow28.6%
0 bulls, 2 cows25.0%
1 bull, 0 cows9.5%
1 bull, 1 cow14.3%
0 bulls, 3 cows5.2%
1 bull, 2 cows4.3%
2 bulls, 0 cows3.6%
2 bulls, 1 cow1.4%
3 bulls, 0 cows0.5%
4 cows, 1 bull + 3 cows, 2 bulls + 2 cowsunder 0.5% together
4 bulls (lucky first guess)1 in 5,040

About four times in five, the first guess scores one or two hits in total. That is why a single guess rarely tells you much on its own, and why you need a plan for the next few.

Strategy: how to crack the code faster

  • Open with 1234, then 5678. The two scores tell you how many of the secret digits are among 1–4, 5–8 and, by subtraction, 0 and 9.
  • Keep a digit grid. Write 0 to 9 across the top of your page and mark each digit as in, out or unknown. Cross a digit out the moment a score proves it is missing.
  • Change one thing at a time. Once you know which digits are in, swap two of them between guesses. If the bulls go up or down, you learn where they belong.
  • Use known-out digits as fillers. A digit you know is missing scores nothing, so it lets you test the other three digits without noise.
  • Only guess numbers that could be right. Before each guess, check it against every earlier score. A guess that breaks an earlier clue wastes a turn.

How good can it get? A computer that checks every possible number can always find the secret in seven guesses or fewer, and needs about five on average. A careful human player usually wins in six to ten guesses.

A short history

Bulls and Cows was played with pencil and paper long before anyone wrote down its rules, so nobody knows exactly where it started. In the late 1960s it became one of the first games played on university computers, under the name Moo, where the computer held the secret number and the player guessed. In the early 1970s it became the board game Mastermind, which swaps digits for coloured pegs and bulls and cows for black and white pins. The word game Jotto works in a similar way with five-letter words.

Variations

  • Three digits for kids: a three-digit number with no repeats has only 720 possibilities, so a round takes a few minutes.
  • Five digits: harder and longer, with 30,240 possible numbers.
  • Repeats allowed: any four digits from 0000 to 9999 (10,000 numbers). Scoring repeated digits gets tricky, so agree how to count them first.
  • Words: use four-letter words with no repeated letters, such as GAME or FISH. A bull is a letter in the right place, a cow a letter in the wrong place.
  • Solo practice: one person draws a secret number with the Random Number Generator set to 0–9 with no repeats, and plays code holder for a group.

Bulls and Cows in the classroom

Bulls and Cows is a good fit for maths lessons on place value and logical reasoning. Draw four digits from 0 to 9 with no repeats on the Random Number Generator, keep the screen hidden and write the secret on a sticky note. Split the class into teams and use the Random Name Picker to decide which team guesses next. Write every guess and its score on the board, so the whole class can reason from the same clues. For more ideas, see our classroom games and random number games.

If your class likes guessing games, try Hangman for letters or 20 Questions for yes or no clues.

FAQ

How do you play Bulls and Cows?

Each player writes down a secret four-digit number with no repeated digits. Players take turns guessing the other number. After each guess the code holder says how many bulls (right digit in the right place) and cows (right digit in the wrong place) it has. The first player to get four bulls wins.

What is the difference between a bull and a cow?

A bull is a digit that is in the secret number and in the same position as in your guess. A cow is a digit that is in the secret number but in a different position.

How many guesses does it take to win Bulls and Cows?

With four digits and no repeats there are 5,040 possible secret numbers. A computer strategy can always find the number in seven guesses or fewer, and about five on average. Most people need six to ten.

Can a digit appear twice in Bulls and Cows?

Not in the standard game: all four digits must be different. Some groups allow repeats as a harder variation; agree on the rule before you start.

Is Bulls and Cows the same as Mastermind?

They work the same way. Bulls and Cows is the older pencil-and-paper game played with digits, while Mastermind is a board game from the early 1970s that uses coloured pegs, with black and white pins in place of bulls and cows.

How do you play Bulls and Cows with a class?

The teacher draws a secret number with a random number generator and keeps it hidden. Students or teams take turns guessing, the teacher writes each guess with its bulls and cows on the board, and everyone works out the code together.

You Might Also Like

Try These Yes or No Tools

✈️