home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!usc!not-for-mail
- From: haddadi@sipi.usc.edu (Navid Haddadi)
- Newsgroups: sci.math
- Subject: Re: Master Mind:A question.
- Date: 15 Dec 1992 04:03:29 -0800
- Organization: University of Southern California, Los Angeles, CA
- Lines: 42
- Sender: haddadi@sipi.usc.edu
- Message-ID: <1gkhihINN78k@sipi.usc.edu>
- References: <1992Dec5.180849.15981@dartvax.dartmouth.edu> <1992Dec13.221551.12761@scorch.apana.org.au> <gay.724358375@sfu.ca>
- NNTP-Posting-Host: sipi.usc.edu
- Keywords: Master Mind Game
-
- In article <gay.724358375@sfu.ca> gay@selkirk.sfu.ca (Ian D. Gay) writes:
- >jimgar@scorch.apana.org.au (Jim Garner) writes:
- >
- >>evant@coos.dartmouth.edu (Evan E. Thomas) writes:
- >
- >>|My question regards the game "MasterMind" where 4 pegs are chosen (from an
- >>[deletions]
- >>|You would be told that 1 color is exactly right and that two others are in
- >>|the solution. You have exactly 10 guesses to find the solution. Is there
- >>|an algorithm that will insure victory?
- >
- >>There is an optimal strategy that has been published. It is very long
- >>and divided into cases, so I wouldn't call it an algorithm. But it
- >>certainly can be done in less than 10 guesses every time. All I
- >>remember is that your first guess should contain 2 colours only, 2
- >>pegs of each.
- >
- > ...
- >that the 5-peg version can usually be solved in 6 guesses; presumably
- >...
-
- Say we are dealing with 5 pegs and 10 colors. So that all possible
- guesses can be represented by {00000,00001,00002,....} There are
- obviously 100,000 possibilities. Say, that we have a way of generating
- all the numbers between 00000 and 99999 in a random sequence (for example,
- by a shift register). It is not too difficult to search the entire
- space. For example, let the first guess be G1. Then let G2 be the
- second sample of the entire space of possibilities. Now score G1 w.r.t.
- G2 and compare the score to the actual score of G1. If they are not the same
- discard G2 and take the next *random* sample. If they are the same then
- propose G2 as a solution. If G2 is not the solution, start the process
- again with G3. This time both G1 and G2 are scored w.r.t. G3 and the
- resulting scores are compared to the acutal scores. We can discard G_N
- as soon as a contradictory score is obtained for smallest n<N. In this
- way searching the entire space only once, a solution is obtained.
- The resulting program is very simple and also very fast. The key is that
- the sequence must be generated in a random way. Although, I have not
- done the analysis, I doubt that the "optimal" solution is any faster (in terms
- of the number of guesses) than this simple method.
-
- Navid.
- haddadi@sipi.usc.edu
-