| CIT 591 Fourth Assignment: A Hand
of Bridge CIT 591, David Matuszek, Fall 2002 |
Purposes:
The Idea:
Play a hand of bridge.
Don't worry--you don't actually have to know bridge in order to do this assignment. In fact, this assignment is "inspired by" bridge in the same way that a movie is "inspired by" a true story. I'm providing some very simplified rules. If you do know how to play bridge, please accept my apologies--but the assignment is still to write a program to play this version, not the real game.
The rules:
A deck of cards consists of 52 cards--13 each in four different suits. The four suits are called Spades, Hearts, Diamonds, and Clubs. Each card in a suit has a number from 1 to 13. Hence we have cards such as "the 4 of Spades" or "the 13 of Diamonds." (We do not have Ace, Jack, Queen, King cards, just numbered cards.)
There are four players, whom we will call North, East, South and West. One of the players, called the "dealer," has extra actions ("shuffling" and "dealing") that she may take; otherwise, the dealer is just like the other players.
Here's how it goes:
Next, thirteen "tricks" are played. Each trick proceeds as follows:
After doing the above 13 times, all cards have been played and the hand ends.
There is no strategy to this game, it isn't scored, nobody wins or loses. It's a stupid game, OK?
Partial Example (one trick):
After the cards are shuffled and dealt:
Since the first card played was a Heart, the player who played the largest Heart (East, with the 8 of Hearts) collects the four cards, and chooses any card from her hand (of any suit) to start the next trick. Whatever card East chooses, the other three players must play cards of the same suit, if possible.
Your assignment:
Figure out what the various classes and objects should be, and what their instance variables and their methods should be. There is no single "correct" design; any reasonable design will do. However, we may take off a lot of points for really bad design, such as (for instance) putting everything in a single class. The better your design, the easier your programming will be.
Use the objects you define to play a hand of "bridge."
Print out at least:
Due Date:
Wednesday, October 16, by midnight. Zip
together all the relevant files, including at least all the.class
and .java files, and submit them via Blackboard.