Bulls and Cows
Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
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.[more]
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.[less]
Contributed by: Marc Brodie (August 2009)
(Wheeling Jesuit University)
Open content licensed under CC BY-NC-SA