Homework Assignment 7

Using Swing : Implementing Mastermind

(a Graphical version of Bulls and Cows)


Due: Friday, November 16th, at 8 AM and 9 AM

Note: We will be conducting in person grading for this assignment upon your return from Thanksgiving


Introduction

This week, our goals are for you to

You will notice that the requirements/specifics are fairly minimal.  This is to give you a bit more freedom to explore Swing and to make some design decisions of your own. As always, feel free to ask questions early and often!

You may work by yourself or with a partner on this assignment. If you choose to work with a partner, then both of you must notify me via e-mail by no later than Wednesday, November 7th.  I will not make any exceptions on this issue.


Task

Implement a version of Mastermind.

For this assignment you will build a graphical version of Bulls and Cows - most of you know this as Mastermind.  As in our previous versions of Bulls and Cows, your program allows the user to play against the computer. 

As in your prior versions, the code-maker (in our version, the computer) selects a sequence of colors (represented in the physical game by pegs).  The code-breaker (in our version, the human user) attempts to break the code.  The code-breaker submits a sequence of colors, and the code-maker responds by telling the code-breaker how many of the values in the sequence are the right color in the right position, and how many are the right color but in the wrong position.  The code-breaker has some limited number of "guesses" to break the code by using the feedback provided by the code-maker.

In playing this game there are several "variables."  In the original version of this game these were set to:

Your program should allow these variables to be provided when creating an instance of the game.  Your program should also provide as a minimum the following features:

Make sure that your program provides this basic functionality.

You may design and implement your game in any object-oriented fashion. However, you should keep in mind that other variations of the game are possible and, whenever possible, you should design your program so that changes to the game would require few and localized changes.  For example, while you are not required to implement the code for this, keep in mind what it would require to modify your game so that

Again, you are not required to implement a program that provides these features, but you should should design your program with future extensions in mind.

Please do not feel constrained to reproduce the physical version of this game.  You may implement any interface, colors, shapes, etc that you feel like using as long as they cover the requirements that I have previously provided.

Of course, you may go beyond the bare minimum of the assignment and choose to implement some of these features. If you do, I'll give you extra credit for your extra effort!


Deliverables

By the due date and time, submit the files:

HOWEVER, you should zip them all together in a single file named PA07.zip.

When doing your paper work, you should also submit

In addition to this, you should bring a printout of your code with you to your in person grading session.