Bulls and Cows Español

Bulls and Cows strategy

With four distinct digits there are 5,040 possible numbers. A strong player narrows them down to one in about five guesses. These ideas get you closer.

1. Open by covering digits

Your first two guesses are for finding out which digits are there, not for hitting the answer. Try 0123 and then 4567 and you have touched eight of the ten digits. The clues from those two guesses tell you how many secret digits are in each group. Any missing ones must be 8 or 9.

2. Add bulls and cows together

Bulls plus cows is how many digits of your guess are in the secret, regardless of position. If 0123 scores 1 bull and 1 cow, exactly two of those four digits are in the secret. Early on, that sum is your most useful clue.

3. Zeros are good news

A guess with no bulls and no cows is not wasted: it rules out four digits at once. Zero bulls helps too: none of those digits goes in the position where you tried it.

4. Change one thing at a time

Once you know the digits, move or swap only a little between guesses. If you change two digits at once and the clue changes, you will not know which change caused it.

5. Check before you guess

Before each guess, run through all previous clues: would your number agree with every one of them? Guessing a number that is already impossible wastes a turn. It is the most common mistake, and the strict-rules mode exists precisely to train it.

How many guesses do you need?

With four distinct digits, the optimal strategy has been shown to need about 5.2 guesses on average and never more than 7 (Koyama and Lai, 1993). Solving it in five or six guesses is very good play. With three digits, four or five guesses is a good result.

In a duel, speed matters

Against another player it is not enough to get it: you have to get it first. Sometimes a guess that might be the answer beats one that only gathers information. Knowing when to take that risk is what separates good players from experts.