How to play Bulls and Cows
Bulls and Cows is a code-breaking game for two players, played with pencil and paper long before the board game Mastermind. Each player picks a secret code, and both race to work out the other's.
- Set your code. At the start, both players pick a secret code of 4 digits on the number pad, at the same time. The digits run from 0 to 9, every digit must be different, and a code may start with 0 (so 0352 is fine, 1123 is not). Your code is shown only to you until the game is over.
- Take turns guessing. A guess follows the same rule: 4 different digits. You cannot repeat a guess you have already made.
- Bulls and cows. Each guess is answered with the number of bulls, digits that are in the code in the same place, and cows, digits that are in the code but in another place. The answer does not say which digits they are.
- Crack it. A guess with every digit a bull (4 bulls) cracks the code.
An example
- The secret code is 4271. A guess of 1234 gets 1 bull (the 2, in the right place) and 2 cows (the 1 and the 4, in the code but in other places). The 3 is not in the code at all.
- A guess of 5698 gets 0 bulls and 0 cows: none of those digits are in the code, which is useful too.
Who wins
- Equal guesses. The player who guesses first would otherwise have an edge, so the game is decided in whole rounds. If the first player cracks the code, the second player still gets one last guess to tie.
- If that last guess cracks the code too, both have needed the same number of guesses and the game is a draw. If it misses, the first player wins.
- If the second player cracks the code first, they win straight away: the first player has already had their guess that round.
- Who guesses first. In a room's first game, Player 1 guesses first. After a game somebody wins, the other player guesses first in the next one. After a draw, the same player goes first again.
Rules the host can change
- Code length. 3, 4 or 5 digits, all different. The room starts at 4, the classic game. Three digits is quick; five is a long hunt.
- Guess limit. Off (0) to start with, so you guess until someone cracks a code. The host can set 8, 10, 12 or 15 guesses each instead. If both players use all their guesses and neither code is cracked, the game is a draw.
- Exactly two players. Bulls and Cows is always one against one. Fill the other seat with a friend or a bot.
Using the number pad
- Tap digits to fill the boxes; a digit you have used is greyed out, since every digit must be different. ⌫ deletes the last digit.
- Press Set to lock in your code, or Guess to send a guess. You can type your next guess while the other player is still thinking and send it when your turn comes.
- On a keyboard, type the digits, use Backspace to delete and Enter to send.
- Both players' guesses are listed side by side, newest at the top, with B for bulls and C for cows.
Rooms, friends and bots
- Start a room. Sign in with Google and press "Create room". No account? Enter a name and press "Start a free game": you can host one free room a day and play up to 3 games in it. Either way you get a six-character code and an invite link to share.
- Join a room. Enter a friend's code on this page, or open their link, then pick a name. You do not need an account to join. Each person plays from their own phone or computer.
- Set it up in the lobby. The host chooses the code length, the guess limit, whether people may watch, and whether guests may join without signing in.
- Add a bot. The other seat can be a computer player at easy, medium or hard level, so you can play alone. A bot picks a random code, and it never sees yours: it works only from the answers to its own guesses, just like you.
- Turn timer. The host can leave turns untimed or set a limit from 15 seconds to 5 minutes. While codes are being set, the clock runs for one player at a time. When it runs out, the room either plays for that player (a random code, or a guess that fits every answer so far, like the medium bot), skips the turn, or removes them from the game, whichever the host picked. A skipped code becomes a random one. A skipped guess is lost but still counts as one of your guesses.
- Leaving. A player who leaves or is removed during a game loses it, and the other player wins by forfeit.
- Dropped connections. If the player whose turn it is loses their connection, the game pauses for up to a minute to let them back in.
- Watching and chat. Anyone with the code can watch without an account and sees every guess and answer, but not the codes until the game is over. Players can chat and send reactions.
Strategy
- Keep a list of what could still be the code. Every answer rules codes out. The best next guess is one that could still be right, or one that splits the remaining codes most evenly between the possible answers.
- 0 bulls and 0 cows is good news. It removes four digits at once.
- Count the digits first. Bulls plus cows tells you how many of your digits are in the code. Two guesses with no digits in common, like 0123 and 4567, tell you how many of the code's digits are 8 or 9.
- Seven is always enough. With good play, any 4-digit code can be cracked in at most seven guesses, and about five and a quarter on average.
The bots
- Easy remembers only the answers to its last two guesses, and guesses any code that fits those. It gets there, slowly.
- Medium keeps track of every answer and guesses at random among the codes that could still be right. It usually needs five or six guesses for a 4-digit code.
- Hard also keeps every answer, and picks the guess that leaves the fewest possible codes on average, whichever answer comes back (the method Donald Knuth described for Mastermind). It averages about five and a quarter guesses for a 4-digit code and almost never needs more than seven.
Questions
Is it free?
Yes. There is nothing to buy and nothing to install, and the game is played for fun only.
Do I need an account?
Only to host more than one game. Without an account you can host one free room a day; it plays up to 3 games, and playing more in that room needs a sign-in. To join a room you just need its code and a name. Guests can send reactions; typing in chat needs a sign-in.
Can the other player see my code?
No. Your code stays on the server and is shown only on your own screen until the game is over. Then both codes are shown to everyone.
How is this different from Mastermind?
Mastermind uses coloured pegs, allows repeated colours and has one code-maker and one code-breaker. In Bulls and Cows both players make a code and both break one, the digits are all different, and you race each other.