Bulls and Cows

๐Ÿ‘ฅ 2 players ๐Ÿ“ Indoor๐Ÿ“ Anywhere โšก Calm ๐Ÿงฉ Moderate โฑ 10-20 minutes ๐ŸŽ‚ Ages 6+

Quick Pitch

Bulls and Cows is a classic code-breaking game that predates the commercial game Mastermind.

Equipment Needed

  • Sheet of paper
  • Pencil or pen
  • Optional: second sheet for tracking guesses

Setup

  1. Choose Code Length: Standard is 4 digits, but can be 3-6 digits (longer = harder)
  2. Choose Number System:
    • Standard: Digits 0-9
    • Variant: Letters A-Z
    • Variant: Digits 0-5 or 0-8 (smaller range makes it harder)
  3. Code Maker: One player creates a secret code of the agreed length
    • Each position must be filled with a symbol from the agreed set
    • Digits/letters can repeat (unless agreed otherwise)
    • The code is written down and hidden from the other player

Example code (hidden):

Code: 4726
  1. Code Breaker: The other player will attempt to deduce the code through guesses

Rules

Objective

  • Code Breaker: Deduce the secret code in as few guesses as possible
  • Code Maker: Keep the code secret and provide accurate feedback

Gameplay

  1. Guess Phase: Code Breaker suggests a code

  2. Feedback Phase: Code Maker responds with feedback:

    • Bulls: Number of digits that are correct AND in the correct position
    • Cows: Number of digits that are correct BUT in the wrong position
    • Example: If code is 4726 and guess is 1234:
      • Position 1: 1 vs 4 (no match)
      • Position 2: 2 vs 7 (2 is in code, wrong spot = 1 Cow)
      • Position 3: 3 vs 2 (2 is in code, wrong spot = 1 Cow)
      • Position 4: 4 vs 6 (no match)
      • Feedback: 0 Bulls, 2 Cows
  3. Record Keeping: Code Breaker records each guess and its feedback

Example tracking:

Guess 1: 1234  โ†’  0 Bulls, 2 Cows
Guess 2: 4567  โ†’  2 Bulls, 0 Cows
Guess 3: 4276  โ†’  1 Bull, 2 Cows
Guess 4: 4726  โ†’  4 Bulls, 0 Cows (SOLVED!)
  1. Win Condition: Code Breaker wins by guessing the exact code (4 Bulls)
  2. Game Length: Typically play until code is broken; some variants set a maximum number of guesses (10-12)

Scoring

  • Count the number of guesses needed
  • Fewer guesses = better performance
  • Common goal: Solve in under 10 guesses
  • Master players often solve in 5-7 guesses

Expert Player

Tips

For Code Breaker (Guessing):

  1. First Guess Strategy:

    • Try a guess with all different digits (no repeats)
    • Common first guesses: 0123, 1234, 0159, 0169
    • These maximize information gathering
  2. Information Analysis:

    • 0 Bulls, 0 Cows: None of those digits are in the code
    • 0 Bulls, X Cows: Those digits are in code but all wrong positions
    • X Bulls, 0 Cows: Those digits are correct positions; others wrong
    • Use feedback to narrow possibilities
  3. Systematic Narrowing:

    • After 1st guess, eliminate digits that aren't in code
    • Focus on getting digits right before positions
    • Once you know which digits are present, work on arrangement
  4. Position Determination:

    • Once you know which digits are in the code, test different positions
    • Cross out position-digit combinations that feedback eliminated
  5. Advanced Technique - The Knuth Algorithm:

    • Used by Donald Knuth to optimally solve in average 5.625 guesses
    • Too complex for paper play but conceptually useful
    • Choose guesses that maximize information gain

For Code Maker (Setting Code):

  • Use a mix of digits/letters for less obvious codes
  • Avoid obvious patterns (1234, 0000, AAAA)
  • Don't place highest digits at highest positions
  • Mix low and high digits throughout
  • Remember: Code Breaker is trying to find your code

Variations

  • With Repeated Digits Prohibited: Code uses only unique digits (4-digit code from 4 different numbers)
  • Longer Codes: 5-digit or 6-digit codes for expert players
  • Smaller Digit Set: Use only 0-5 or 0-3 (fewer possibilities, but still challenging)
  • Letter Codes: Use A-Z instead of 0-9
  • Different Symbols: Use colors, shapes, or icons represented by letters
  • Time Limit: Add time pressure to increase difficulty
  • Penalty System: Guesses beyond X attempts incur point penalties
  • Scoring Variant: Multiple rounds; score based on guesses needed
  • Switched Roles: Play multiple rounds with players switching code-maker/breaker roles
Learn More โ€” History & Origins

History & Origins

Bulls and Cows originated in the 19th century as a popular mathematical guessing game, though its exact origins are unclear. It exists in various forms across cultures. The game gained renewed attention when Milton Bradley released "Mastermind" as a commercial board game in 1971, which uses colored pegs instead of digits. The paper version predates Mastermind and remains a timeless logic puzzle. Some historians note similar games appearing in earlier 19th-century publications.

Cultural Context

Bulls and Cows influenced the design of Mastermind and demonstrates the enduring appeal of deduction games. The game appears in recreational mathematics texts and serves as an excellent introduction to code theory and cryptography concepts. It's used in education to teach logical reasoning, hypothesis testing, and systematic problem-solving.

The game perfectly illustrates the difference between having information and interpreting it correctly. A seemingly simple mechanic (feedback of Bulls and Cows) creates surprising strategic depth. Computer scientists have used Bulls and Cows variants as test cases for optimization algorithms.

See Also