Bulls and Cows (head-to-head)

Start game with computer guessing:
Next guess:

  • Bulls and cows is a lot like the commercial game MastermindTM, but using four-digit numbers instead of coloured pegs.
  • In this version, you play head-to-head with the computer, taking alternate turns to guess each other's number.
  • The winner is the first player to guess their number. You always play first and so have a small advantage.
  • Each guess is marked according to how many bulls (that is correct digits in correct locations) and how many cows (that is correct digits but in the wrong position) are present in the guess. The number of bulls and cows for each guess is displayed in red to the right of the guess.
  • The computer has a simple strategy: its first guess is random, then it tries each next highest number in turn, using the first one it finds that fits the marking so far.
  • To play the game, first enter a number for the computer to guess (it doesn't cheat!) at the top of the table, then enter your guesses at the bottom of your column.
  • It is possible to beat the computer if you are skilfull! Here is a page that discusses the mathematics of the Mastermind game.

JavaScript © 2004 Mark Huckvale, University College London