COMP 1600 Project 4: Master Mind
30 points
Deadline: end of Lab April 22
You may complete this assignment either individually or with one partner
For this lab project, you are to complete the implementation of the MMGame class that maintains the internal state and accepts and evaluates guesses for the MasterMind game that I have described in class. I have provided the design of the class specification, specifying each of its public methods. I have also established all of the instance variables you will need. It is your task to implement each of the methods that is not fully implemented. The MMGame() constructor without parameters is implemented for you, as are each of the accessor ("getter") methods.
In the I:\COMP\1600\20142-COMP-1600-01\Common folder, you will find a folder called Project4. Copy this into your workspace. If you cannot access the I: drive, then download the project zip file (right-click) and unzip.
The project will compile and run as provided but will show test failures. Make sure you can compile and run it before proceeding. Note that main() is in MMTest.java
Suppose the solution is 5300 and your guess is 1000. The response should be complete=2, partial=0. There are two 0's in correct positions (third and fourth) but the rest are not found. Implementation note: notice that the first 0 is not counted as a partial even though it is a correct digit in the incorrect position! This is because the third and fourth 0's in the guess will match exactly ("completely") those positions in the answer. A given position in the guess cannot contribute to both complete and partial counts.
The following table represents a sequence of guesses and responses for this
example, which was guessed after 6 tries.
|
answer |
|
|
|
|
5300 |
|
|
|
|
5300 |
|
|
|
|
5300 |
|
|
|
|
5300 |
|
|
|
|
5300 |
|
|
|
|
5300 |
|
|
|
You have the option of working with a partner to develop one solution. If you do this, you will follow the "pairs programming" technique. The first decision will be whose login account to use since you can only use one. Once that is decided, then pairs programming is pretty straightforward: both of you work at one PC (you can use a second one for Googling and API lookups). The "driver" is at the keyboard typing in code and testing. The "navigator" is at the side, directing the driver, giving advice, and watching for keystroke errors. After 45 minutes you must switch roles. We don't have easy access to folders shared by both members of the partnership, so you should work out a way to make sure both of you have up-to-date code at the end of each working session.
When finished, copy MMGame.java into your I:\COMP\1600\20142-COMP-1600-01\DropBox folder. If you are working with a partner, submit to only one partner's folder. Be sure the comments in the course code file has both names.
Points | Item |
---|---|
4 | 2-parameter constructor |
6 | randomString |
6 | guess |
6 | numComplete |
8 | numPartial |