CSCI 1302 Programming Project 1 Summer 2008 MasterMind This program is due by midnight on Friday, June 20. MasterMind is a simple game of logical deduction that first appeared commercially as a board game in 1970; for more background, google "Master Mind" and select the Wikipedia article. In this assignment you will implement MasterMind to play from the command line. The rules of basic MasterMind are: *There is a goal of the form g1 g2 g3 g4 where each gi (i = 1, 2, 3, 4) is in the set {1, 2, 3, 4, 5, 6} of "colors"; they need not be distinct, and the order is important. In play, the goal will be constructed by the game program and not revealed to the player. (The goal is represented by a sequence of colored marbles in the board game.) *The player makes a series of guesses until she/he guesses all four colors correctly, including their order, up to a maximum of 10 guesses. The player tries to use as few guesses as possible. The form of the guess is the same as the form of the goal. *After each guess, the game program responds with two numbers which we'll call bp and wp; they are the numbers of black and white pegs in the board game. If the guess is x1 x2 x3 x4 then bp is the number of i (1 <= i <= 4) such that xi = gi. The sum bp + wp is the maximum number of black pegs which would be scored by some permutation of the guess. The game ends normally when the guess is correct (bp = 4) or when 10 guesses have been made, whichever comes first. Also the player can end the game by quitting (see below). Some things to note: *Start out by asking the player if she/he would like to play a random game. If the answer starts with 'y' or 'Y' then generate the goal randomly and prompt the player to enter her/his guess. Otherwize, prompt the player to enter the goal (for debugging) and then proceed as before. *Use the exception handling mechanisms of Java to gracefully ignore wrong input and remind the player as to the correct form of input, then give her/him another chance at the guess (with no limit on the number of tries at the guess, and not counting input of the wrong form as a guess). *Allow the player to terminate the game by entering a guess that begins with the character 'q' or 'Q'. *Report the end of the game (whatever the reason for termination) to the player, along with the number of guesses, then end the game program. *Develop this program following proper methodology, starting with a written plan. Develop the code one method at a time, with readable formatting, meaningful identifier names and illuminating comments. For each method, write the test code for it before writing the code for the method itself. *The submission procedure is described on a separate page which is linked from the "projects" page. Follow it carefully. *A project which does not compile on atlas using version 1.5.0 Java will score 0. Projects which do compile properly will be scored as follows out of 100 (if on time): 30 pts. for good style (meaningful identifier names which indicate class/object by capitlaization, consistent indentation and formatting, comments which make intention clear); 20 pts. for design modularity (generating the goal and playing one move should be separate methods; include testing and debugging methods); 50 pts. for correct operation. *For up to 20 pts. of extra credit, allow the user to specify the number of marbles (4 is the default), the number of colors (6 is the default), and the maximum number of guesses for the game (10 is the default).