- Play a few games of Mastermind on a computer. You can use
if you did
not complete one yourself.
- Think of and describe strategies for getting the solution in as few goes as possible.
Assume six colours and four pegs.
You can search the Internet for possibilities.
- A very naive strategy will simply try all configurations
in a particular order, ignoring any black and white peg information.
- A better strategy will simply try the next possible feasible guess.
A feasible guess is one which is a possible solution given the information
(black and white pegs of previous goes) so
- Write a GUI version of mastermind which can demonstrate strategies where the computer tries to guess the
user's colours. Test it out with a simple strategy if necessary.
- Implement a `cleverer' strategy (the gets the answer in fewer goes).
(If you like you can implement a few different clever strategies and compare
them.) Clearly state whether the strategy is your own idea or something you have
found. If you found it, it is essential that you cite the source.
If you don't do this it is plagiarism. Don't tell other students
your strategies or where you found them.
- Write a GUI version of mastermind using your cleverer strategy.
is my GUI version of a cleverer strategy that
guesses correctly in an average of 4.499 goes for 6 colours and 4 columns.)
- Write programs (without a GUI) that work out the average number of
guesses taken, using different strategies. Your program should play hundreds of games
in order to work out the average (In fact for this exercise you can try
all possible initial configurations).
You must put the averages in your report and explain them.
The lower your average the better your
strategy. Fully explain your code both as comments and separately in the report.
Sebastian Danicic BSc MSc PhD (Reader in Computer Science)
Dept of Computing, Goldsmiths, University of London, London SE14 6NW
Last updated 2015-09-04