Bulls and Cows

From Wikipedia, the free encyclopedia
  (Redirected from Bulls and cows)
Jump to: navigation, search
For the animal, see cattle.
4digits, an Open Source version of Bulls and Cows.

Bulls and Cows (also known as Cows and Bulls or Pigs and Bulls or Bulls and Cleots) is an old code-breaking mind or paper and pencil game for two or more players, predating the similar commercially marketed board game Mastermind.

It is a game with numbers or words that may date back a century or more. It is played by two opponents.

The numerical version[edit]

The numerical version of the game is usually played with 4 digits, but can also be played with 3 or any other number of digits.

On a sheet of paper, the players each write a 4-digit secret number. The digits must be all different. Then, in turn, the players try to guess their opponent's number who gives the number of matches. If the matching digits are in their right positions, they are "bulls", if in different positions, they are "cows". Example:

  • Secret number: 4271
  • Opponent's try: 1234
  • Answer: 1 bull and 2 cows. (The bull is "2", the cows are "4" and "1".)

The first one to reveal the other's secret number wins the game. As the "first one to try" has a logical advantage, on every game the "first" player changes. In some places, the winner of the previous game will play "second". Sometimes, if the "first" player finds the number, the "second" has one more move to make and if he also succeeds, the result is even.

The game may also be played by two teams of 2–3 players. The players of every team discuss before making their move, much like in chess.

A computer program moo, written in 1970 by J. M. Grochow at MIT in the PL/I computer language for the Multics operating system, was amongst the first Bulls and Cows computer implementations, inspired by a similar program written by Frank King in 1968 and running on the Cambridge University mainframe. Because the game has simple rules, while it is difficult and entertaining, there are many computer variants; it is often included in telephones and PDAs.

It is proven that any number could be solved using up to seven turns. Minimal average game length is 26274/5040=5.2131 turns.[1][2]

The word version[edit]

This version is usually played orally, but is easier to play if each player (or each team) keeps written notes. It is exactly like the numerical version except instead of 4-digit numbers, 4-letter words are used. They must be real words, according to whatever language or languages you are playing the game in. Alternate versions of the game can be played with 3-letter or 5-letter words, but the 4-letter version is the most popular. This game was quite popular at IIT-K some years back, and is much more engaging than the numerical version. Several versions of this game is available in Computer & Mobile devices. But the first official massively multiplayer (MMO) version of this game was first made available for Android devices under name WORD - Multiplayer Word Game. The Game play for letter version of this game is as follows.

A person (HOST) thinks of any Isogram word in his mind, and gives out the number of letters in the word.

Other players (GUESSERS) try to figure that word by guessing isogram words containing same number of letters.

Then the person who thinks of the word tells the number of Cows & Bulls for the word given by others.

Cows - The guessed word has letter/letters those from the word that has been thought but at different positions.

Bulls - The word that has been guessed has the letters at the same position of the word that has been thought.

e.g. Say person hosted thinks of a word HEAT and everyone else is guessing,

One of the guessers Guess: COIN

Host will answer as follows:

COWS-0 (No similar letters at all)

BULLS-0 (No letters in the same position)

if Guessed word is- EATS

COWS-3 (Since the letters E, A and T are in the word, but are in the 1st, 2nd and 3rd position in the word EATS, while in the word HEAT, the letters E, A and
T are in the 2nd, 3rd and the 4th spot respectively.)
BULLS-0 (No letters match the spots in the original word)

COWS-0 (There are similar letters but they're in the same spot, meaning they'll come under BULLS)
BULLS-2 (E and A from PEAR are in the same spot as in the letters E and A in HEAT.)

The person who figures out the word getting all bulls right gets to host the next word.[attribution needed]

See also[edit]

  • Fallout 3 and Fallout New Vegas feature a 'letter-version' of this as a minigame for hacking computers.
  • Sleeping Dogs included a version (with the digits 1 to 9) minigame for hacking security cameras.
  • Neverwinter Nights 2: Mask of the Betrayer implements a version of this as the "Hells" game, in which the player must guess the correct sequence of nine unique Hells (similar to the digits 1 through 9)[3]
  • Jotto—a similar game with words
  • Mastermind—a similar game with coloured pegs instead of digits


  1. ^ Optimal algorithms for bulls and cows game.
  2. ^ http://www.cs.nccu.edu.tw/~chaolin/papers/science3203.pdf (Chinese version) Chao-Lin Liu. "Mathematics, Computer Science, and Number Games", Science Monthly, 32(3), 250-255, 2001.
  3. ^ http://lparchive.org/Neverwinter-Nights-2-Mask-of-the-Betrayer/Update%2024/

External links[edit]