Question: Master Mind is a code breaking game. A secret code is selected by one player and another player tries to guess the code. The secret

Master Mind is a code breaking game. A secret code is selected by one player and another player tries to guess the code. The secret code has four positions and each position is assigned a color out of seven possible colors. It is legal to have multiple positions assigned the same color. In this version of Master Mind, the computer selects the secret code randomly. To win the game, the player must determine the correct position and color of the randomly generated secret code. A guess is composed of selecting a color for each of four positions. After each guess, feedback is obtained which is used to improve the guess until an exact match of each color and position of the secret code is obtained. The secret code must be obtained in eight or fewer guesses. Feedback is determined as follows: A black "button" is awarded for each of the four guess elements that matches both color and position of the secret code. A white "button" is awarded for each of the four guess elements that matches a color but is not in the correct position. A guess element can be awarded at most one button (may be tricky). It is likely that a given guess will have fewer than four (and maybe zero) buttons awarded. Starting Files: MasterMind.zip //unzip in your working directory Guess.java MasterMind.java MasterMindAI.java MasterMindAIRandom.java MasterMindAIConsistent.java MasterMindAIMiniMax.class Lab: Interfaces

Primitive Arrays and ArrayList

Command Line Arguments Part I: Evaluating a Guess Complete Guess.java. You will be comparing a guess to the secret guess to determine the number of black buttons and white buttons to provide as feedback for that guess. The first element of the integer array is the number of black buttons, and the second element is the number of white buttons. The trick is to make sure that a given guess element is not awarded more than one button. You will probably want to assign the black buttons first. Part II: Master Mind AI Complete the MasterMindAI.java interface and then implement that interface to write MasterMindAIRandom.java. This simple AI makes a random guess, hoping for a miracle. The relevant methods within the given Random Class (Singleton Pattern) are the following: public static Random getRandomNumberGenerator() //creates a new Random object

public int randomInt (int low, int high) //Returns a randomly generated integer between low and high (inclusive of both). Implement the MasterMindAI interface again to complete MasterMindAIConsistent.java. The strategy that you will employ is straightforward and works quite well. Make a random guess where a guess is four integers (each integer represents a color) between 1 and 7. Make sure that the randomly selected guess is consistent with the feedback provided for all previous guesses. If it is, make that your official guess. If it is not, make another randomly generated guess, repeating the process until you identify a guess that is consistent with previous guesses. Note that your AI has a reference to the MasterMind game so that it can obtain required information. This is better than having both the AI and MasterMind remember information about MasterMind (namely, all previous guesses and associated feedback). Your AI can simply request information when needed. Of particular importance are the two getResult methods in the MasterMind class. One of these can be used to obtain previous feedback (guesses are tested against the secret code) and the other allows guesses to be compared to one another ("pretend" that one of the guesses, the second parameter, is the secret code). Part III: Master Mind Game Complete MasterMind.java so that the user can specify the type of game desired at the command prompt. A 0 indicates a human player, a 1 indicates that the game should use MasterMindAIRandom, a 2 indicates MasterMindAIConsistent, and a 3 indicates MasterMindAIMiniMax. Your game should also allow the player to change between ais and from ai to human by typing 0, 1, 2, or 3. It is not possible to change from human to ai as the change could occur in the middle of a guess! Only

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!