Homework 8 - GUIs - part one of a card game utility

Reading: Java by Dissection, Chapters 8 and 9

Due Tuesday March 4th, at 10pm.

Program Description - A card table display

In this assigment and the next two you will create a program that lets four players play a card game over the internet. For this basic utility, it knows almost nothing about the game. It is a utility that could be used with any number of games. It works for any game that fits the following descrption: Your utility will:
  1. Shuffle the cards.
  2. Deal 13 cards to each player.
  3. Display the local player's hand to the player.
  4. Display one card for each player appropriate.
  5. Provide for removal of the four cards displayed (one per player).
For this first part of the three part assigment, you are to create a graphical user interface (GUI) using Java's swing API that does the following: The cards must be displayed with graphical images similar to the ones found at http://www.waste.org/~oxymoron/cards/. I suggest you just use those but you are welcome to use others if you prefer. Whatever you use must be easily recognizable as the cards from a conventional pack of 52 cards comprised of 13 ranks (ace through king) and 4 suits (clubs, diamonds, hearts, and spades).

A number of aspects are intentially unspecified, leaving you freedom to make your own choices. For example, what happens if you indicate for a player to play a card and they have already played one? You could simply play another one, or you could give some warning that the player had already played.

For this part of the project, card selection is arbitray. For example, it is perfectly fine to just chose the "next" card in the hand. It is important that once a card has been played, that player cannot play that card again (until possibly after a new deal). That is, playing a card removes it from the player's hand.

Getting Started

To help you get started I am providing five files. To run CardTest you will need to have download the card images from http://www.waste.org/~oxymoron/cards/ and place them in a subdirectory named "cards" in the same directory as the Java files.

You may also find the classes Deck, Card, Rank, and Suit from Java by Dissection chapter 6 useful. Those files can be found at: http://www.soe.ucsc.edu/~charlie/java/jbd/code/chap6/

What to turn in

This program, if done properly, will consist of a rather large number of files. To allow for ease in grading please do the following:
  1. Name the class containing main() CardGame.
  2. Create a jar file containing all of your source files and your card images directory. Assuming your card images are in a subdirectory "cards" in the same directory as your source files, then you would create the jar file with:
    jar cf cardgame.jar *.java cards
    
  3. Be sure and name the jar file, cardgame.jar. Your program will be tested with the following sequence. It is strongly advised that you make a copy of your jar file in an otherwise empty directory and try this before submmitting it.
    jar xf cardgame.jar
    javac *.java
    java CardGame
    
    Programs that do not compile and produce some GUI in response to the above will receive a 0 and not be looked at further.
  4. Submit the jar file.

Design/Correctness Points

It is important for this assignment that you achieve a clean design for this assignment. You are strongly encouraged to create at least an informal design using something like CRC cards or a UML class diagram before implementing much if any code.

20 points - well designed classes
20 - shows four cards on the table and can have the card images change
10 - allows for the cards to be cleared from the table
10 - shuffles and deals the cards to 4 players at least once
10 - can reshuffle and redeal
5 - miscellaneous