How to play Bulls and Cows
- Choose the game: codes of 3, 4 or 5 digits (4 is the classic), and a match of best of 3 or best of 5 rounds.
- Pick a secret code for your rival to crack. It uses the digits 0 to 9, every digit different, and it may start with 0 (so 0472 is a fine code). Can't decide? Tap Pick one for me. With 2 Players, a cover screen asks the other player to look away while each of you chooses, and your digits show as dots until you tap Show.
- Take turns guessing your rival's code. A guess follows the same rule: the right number of digits, all different.
- Read the answer. Each guess is scored straight away:
- Bulls (the green sticker with horns): how many digits are the right digit in the right place.
- Cows (the yellow sticker with floppy ears and a spot): how many digits are in the code, but in a different place.
- Digits that aren't counted as either aren't in the code at all.
- Crack the code: when every digit is a bull (4 bulls in the classic game), you've cracked it.
- Win the round: whoever cracks the other's code in fewer guesses wins the round. When the player who guesses first cracks the code, the other player still gets the same number of guesses: cracking it with the same number makes the round a draw. Each of you gets 10 guesses in the four-digit game (9 with three digits, 12 with five); if neither of you cracks the code by then, that's a draw too.
- Win the match: the first to win 2 rounds (or 3 in a best of 5) wins. Drawn rounds don't count, so a match can run past three rounds; after 6 rounds (10 in a best of 5) whoever is ahead wins, and level scores make the match a draw. The player who guesses first changes every round.
An example guess
Say your rival's secret code is 3104 and you guess 1023. The answer is 0 bulls, 3 cows: the 1, the 0 and the 3 are all in the code, but none of them is in its right place, and the 2 isn't in the code at all.
Next you try 3201. The answer is 2 bulls, 1 cow: the 3 and the 0 are in the right places, the 1 is in the code somewhere else, and the 2 is out again. 3104 is one of the codes that fits both answers, so you try it: 4 bulls, cracked in three guesses.
Controls
- Guess: tap the digit keys on screen, or type digits on a real keyboard, then press Enter. The delete key (⌫ on screen, Backspace on a keyboard) takes a digit back. Digits already in your guess are greyed out.
- Notes: tap Notes (or press N), then tap a digit to cross it out, again to circle it and again to clear it. Use it to remember which digits you've ruled in or out. Each player has their own notes, shown on their own turn. Tap Notes again to go back to guessing.
- Choose a secret code: tap the digits or type them, then press Done (or Start against the computer).
Both boards stay on screen, with each player's rounds won beside their name. Neither shows a secret code, so you can watch each other's progress. Against the computer, your own code is shown under its board (except on a phone held sideways, where there is no room).
Computer levels
The computer's secret code is picked at random. That's not laziness: the rules treat every digit and every place the same, so every code is exactly as hard to crack as any other. When it guesses yours, it never sees it. Like you, it only sees the bulls and cows on its own guesses, and it works out which codes still fit.
| Level | How it guesses your code |
|---|---|
| Easy | Guesses a code that fits the last answer, but often forgets the older ones |
| Medium | Guesses any code that fits every answer so far |
| Hard | Tries ten codes that fit and plays the one whose answer will tell it most |
| Expert | Weighs every possible code (a big sample of them with five digits), even ones it knows can't be right, if they tell it more |
In our tests with four digits, Easy needed about 7 guesses on average, Medium about 5.5, and Hard and Expert about 5.3 (Expert a little lower, and very rarely more than seven). That's close to the best anyone can do: worked out by computer, the best possible average is about 5.21 guesses, and every four-digit code can be cracked within seven. Medium, Hard and Expert are close together because simply guessing a code that fits every answer is already a strong way to play, so each level beats the one below only a little more often than it loses. Three-digit codes take about as many guesses as four (each answer tells you less), and five-digit codes about half a guess more.
Tips for cracking codes
- Every guess should fit. Before you guess, check it against all your earlier answers. A code that can't be right wastes a turn, unless you're testing digits on purpose.
- Count the digits first. Bulls plus cows tells you how many of your digits are in the code. With 0 bulls and 0 cows, all four digits are out: cross them off in your notes.
- Move digits around. If a digit was a cow, it's in the code but not where you put it. Try it somewhere else next time.
- Change one thing at a time when you're close. Swapping two digits and seeing whether the bulls go up or down tells you exactly where they belong.
- Remember there are ten digits. With four in the code, six are left out. Two guesses with no repeated digits between them, such as 0123 and 4567, tell you how many of the code's digits are 8 or 9.
- Watch the other board. If your rival cracked your code in five guesses and you guess second, you need this guess to draw, so play a code that fits.
Bulls and Cows at home and at school
Bulls and Cows is an old pencil and paper game, also called Cows and Bulls. It practises logical thinking, place value and careful checking, and it suits anyone who can count to ten. The answers here are worked out by the game, so younger players can't be tripped up by a miscounted answer, and older players can try the five-digit game or keep the notes in their head. There's more for grown-ups on our page for parents and teachers.
The game has a place in computer history too. One of the first computer versions, called MOO, was written by Frank King at the University of Cambridge in about 1970, and it became so popular there that the computer's administrators had to stop it from clogging the system. It was later carried over to other early computer systems, including early Unix at Bell Labs.
Questions
What is the difference between a bull and a cow?
A bull is a digit that's in the code in exactly the place you guessed it. A cow is a digit that's in the code, but in a different place. A digit counts once, as either a bull or a cow, never both.
Can a code start with 0?
Yes. Any digits from 0 to 9 can go anywhere, as long as every digit in the code is different. So 0123 and 9870 are both fine codes.
Can I repeat a digit in a guess?
No. Guesses follow the same rule as codes: every digit different. That keeps the bulls and cows easy to read.
How many guesses do you get?
Ten each with four digits, nine with three and twelve with five. That's more than careful play needs, so the limit only ends rounds where nobody was using the answers. If neither of you cracks the code, the round is a draw.
What happens if we both crack the code in the same number of guesses?
The round is a draw and doesn't count. Keep playing until someone wins enough rounds, or until the round limit, when whoever is ahead wins the match.
Does it matter who guesses first?
Very little. Guessing second lets you know when you need to hit the code to draw. In 3,000 rounds between two Expert computer players, the second guesser won 970 and the first guesser 878, with 1,152 drawn. To keep things fair, the first guesser changes every round.
Can two people play on one phone?
Yes. Choose 2 Players. Each of you picks a secret code behind a cover screen while the other looks away, then you pass the device back and forth as you guess. Nobody has to answer with bulls and cows: the game does it for you, so nobody can give away a wrong answer by mistake.
Updated 22 November 2026