Jotto: Refactoring GUI Code for Extensibility

This project is intended to help you practice some of the programming and design techniques discussed in class recently, specifically writing GUIs and developing inheritance hierarchies. The problem is to simulate a game of Jotto. A complete solution to the problem is provided.

Understanding the Design

Start by reading the given code and making sure you understand it. The following questions should guide your analysis of the design of the current code:

Refactoring

Refactor the current code to use an inheritance hierarchy of player types such that it minimizes the amount of new code required to add another computer player. Specifically, the current code uses a variety of conditional statements to determine if the computer or the user is playing. You should create an interface, Player, that is implemented by at least two concrete classes, HumanPlayer and ComputerPlayer, each created by the GUI that closes the model code to adding additional players.

Refactor the current code to use a resource file for all of the text strings shown to the user, either as labels on buttons, prompts, or messages given as feedback.

Refactor the current code so the number of guesses a player can make is correctly reflected in the number of text fields shown in the GUI.

Testing

You do not need to write unit tests for this program, however, there are at least two bugs in the code provided that you will need to find and fix.

Additionally, you should attempt to bullet-proof the code from bad input from the user. Several cases are already handled but not all cases. For each case where the user can provide bad input, you should give back specific and constructive feedback to help the user understand and fix the problem.

Improving

Provide the player with two additional options in the GUI:

The current code includes only one computer player that guesses a word, that correctly conforms to its history of guesses, randomly. You should add at least one additional computer player that chooses its word to guess each time more intelligently.

To facilitate playing your computer solutions against each other, allow a two player option that allows two GUIs to be displayed at once, each with a different player in control.

For extra credit, come up with separate GUIs for computer and human players. These GUIs should share as much code as possible and have a similar look, but clearly differentiate the role the user plays in giving input to the model.

Submission

Export the project as a .tar file and save it in your turnin directory.

Grading (250 pts)

You will be evaluated on the following criteria: