JavaScript is disabled so the dynamic features of this page will not work. To use UmpleOnline, turn Javascript on. Otherwise you can download the command-line Umple compiler or use Eclipse.
// Umple class diagram representing card games
// in the Oh Hell and Whist family
class Card {
suit; // "hearts", "clubs", "diamonds", "spades"
rank; // A23456789JQK
Boolean isJoker; // suit and rank are null for a Joker
}
class CardSet {
// Could be a complete deck or a trick
1 -- * Card;
}
class NotDealtCardSet {
// This would be initialized with a complete 52-card set
// at the start of each game
// During dealing, the cards would be distributed to players
isA CardSet;
}
class Trick {
// A group of cards with one contributed by each player, and
// eventually won by a player
// One is built after each player has played a card
isA CardSet;
}
class Player {
// These are the people playing.
name;
// A hand is dealt at the start of a game
// The cards a player has in his or her hand
0..1 -- * Card hand;
// The tricks won by a player this game
1 -- * Trick;
// All hands and tricks are cleared at the end of each game
// ready for dealing again
// The following is used only in Oh Hell
Integer currentTricksBid;
}
class ScoringTeam {
// for Oh Hell, it is each player for himself, so there is one player
// for Whist there are partners, so there are two players
1 -- 1..2 Player;
// The score that each team has accumulated so far
// based on tricks taken or difference between tricks and bid
Integer score;
}
class CardsMatch {
// A cards match is played in a number of games
Boolean isWhist; // True if whist; false if Oh Hell
// The following determines the players
// the first player in the first team deals first
* -- 2..* ScoringTeam; // Exactly 2 if Whist
Integer scoreToWin; // The score agreed to in order to declare winner
1 -- * Game games; // Games continue until a player or team wins
// Assume that the last game in games is the current one
}
class Game {
trumps; // a suit (if any) that is the trumps for this game
// One player is the dealer each game
// The dealer deals out all or most of the cards at the start
// Players take turn laying down cards to form the next trick
* -- 1 Player dealer;
// As the cards are laid down the following set is created.
// After all players have contributed a new trick is created from the
// following and awarded to a player
0..1 -- * Card currentTrickBeingBuilt;
* gameLed -- 0..1 Player currentLead; // the player next to lay down a card
}
//$?[End_of_model]$?
//Position information of the display on a diagram of all classes and of their associations
class CardSet
{
position 186 153 109 45;
position.association Card__CardSet 30,0 87,92;
}
class NotDealtCardSet
{
position 129 244 123 45;
}
class Trick
{
position 278 245 109 45;
}
class Player
{
position 43 429 192 82;
position.association Card:hand__Player 7,0 0,88;
}
class ScoringTeam
{
position 561 411 122 64;
position.association Player__ScoringTeam 0,31 192,55;
}
class CardsMatch
{
position 532 48 159 82;
position.association CardsMatch__ScoringTeam 120,82 60,0;
position.association Game:games__CardsMatch 29,84 116,0;
}
class Card
{
position 75 22 134 92;
}
class Game
{
position 431 258 123 58;
position.association Game__Player:dealer 0,33 193,9;
position.association Game:gameLed__Player:currentLead 20,58 193,29;
}