Bulls and Cows

This Demonstration lets you play the classic game "Bulls and Cows" against the computer. Other names are "moo" and the trademarked name "Mastermind." The default settings are four pegs and six colors, the same as were used in the physical game. Variants allow the player to select from two through six pegs, and from two through eight colors.
In this game, the computer randomly selects an arrangement of colors (with repetitions allowed). You are to determine that arrangement by making successive guesses. The guesses become more educated at each turn, since feedback is provided.
To make a guess, click the four squares at the top of the pane to change their colors, then press the "submit" button. If you pass a color that you wanted, just keeping clicking—they cycle. Note: at the beginning of the game, and after each turn, the squares return to white, which is one of the permissible colors.
After you press the "submit" button, your guess will appear below along with two numbers. The first number is the number of pegs (colors) that are correct and in the correct position. The second number is the number of remaining pegs (those not counted by the first number) that appear in the correct answer, but in a different position.
  • Contributed by: Marc Brodie (Wheeling Jesuit University)
comments
 
Powered by Wolfram Mathematica
Give us your feedback
Give us your feedback

Source page:




 often  occasionally  never

Note: Please do not include anything you consider confidential or proprietary. Your message and contact information may be shared with the author of any specific Demonstration for which you give feedback, but will not otherwise be published or distributed.
Privacy Policy »

Note: To run this Demonstration you need the free
Mathematica Player
or Mathematica 7+
Download or upgrade to Mathematica Player 7
I already have Mathematica Player or Mathematica 7+