This is a JavaScript version of the Four Digit Number Game, which itself is a variant of the commercial game Master Mind. There are some other primitive, computer implementations which have been seen under various names, including moo, as well as an old, Macintosh implementation. Before describing Mark4 it should be noted that the Four Digit Number Game is a very entertaining game of logic that can be played between two people with paper and pencil practically anywhere that time needs killing (e.g., at airports, at rocket integration, at a terminal of a time-share computer system).
Basically, player A and player B each think of (write down) a number, the target. Then A tries to guess B's number while B tries to guess A's number. A number, whether it's a guess or a target, consists of four digits (hence the devilishly clever name of the game) with no digit appearing more than once in the number. When A makes a guess, B tells A the score of the guess. The score consists of two integers. The first integer is the count of the digits in the guess which are in the right place, that is, in the same place in the guess as in the target. The second integer of the score is the count of the digits in the guess which are in the wrong place, that is, in a different place in the guess than in the target. The players take turns guessing until one of them guesses the target (i.e., gets a score of 4 in the right place and 0 in the wrong place). Then the other player continues making guesses until he gives up or guesses the target. Obviously, the player who gets the target in the fewest guesses is the winner of the game.
As you have probably guessed by now, Mark4 lets you play this game against your machine. You make your guesses by selecting the digits in the Human side. When you have the digits you want in your guess, push the Guess button. Then, that guess with its score is displayed in the Human's scoreboard. If you give up, pushing the Reveal button displays the target in the Human's guess digits. Pushing the Human's New button starts it over scoring your guesses against a new target.
The program displays its guesses in the Machine's scoreboard. You score its last guess by selecting two digits at the bottom and pushing the Score button. Then the program makes its next guess unless either the last guess was correct or the scores are inconsistent. If you make a mistake scoring, push the Retract button to back up to the previous guess. If you want the program to guess a number, but you are too lazy to score it yourself, and you trust the machine not to cheat, then you set the target for automatic scoring of its guesses by selecting a four digit number at the top and pushing the Machine's Target button. Pushing the New button starts the program guessing an unknown (except by you) number. If you don't even want to think up a number push the Random button to get the program to supply a target.
The JavaScript, Java, and Macintosh versions of the game were designed and programmed by Hank Dolben who learned the pencil and paper version of the game from Mark Widholm.
This program is free, distributed under the GNU General Public License.
Your browser got this page
last modified