You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.1 KiB
67 lines
1.1 KiB
# Card Game
|
|
|
|
```plantuml
|
|
Game o-- Players
|
|
class Game {
|
|
Players players
|
|
private Pile deck
|
|
|
|
public Game(int numberOfCards, int numberOfPlayers)
|
|
}
|
|
|
|
Player o-- Pile
|
|
|
|
class Players<extends ArrayList<Player>> {
|
|
Pile pot;
|
|
Pile draws;
|
|
public void play()
|
|
private int playersLeft()
|
|
private void givePotOnWin()
|
|
}
|
|
|
|
Players *-- Player
|
|
|
|
class Player {
|
|
String name;
|
|
Pile drawPile;
|
|
Pile discardPile;
|
|
|
|
Player(String name, Pile drawPile)
|
|
public Card draw()
|
|
public int cardsCount()
|
|
}
|
|
|
|
ArrayList *-- Card
|
|
|
|
class ArrayList< Card > {
|
|
public boolean isEmpty()
|
|
public int size()
|
|
public boolean add(Card card)
|
|
public boolean addAll(Collection<Card> card)
|
|
}
|
|
|
|
enum Suit {
|
|
CLUBS,
|
|
SPADES,
|
|
HEARTS,
|
|
DIAMONDS
|
|
}
|
|
Card o-- Suit
|
|
|
|
class Pile extends ArrayList {
|
|
public static Pile createDeck(int numberOfCards)
|
|
public Pile take(int number)
|
|
public void shuffle(Random random)
|
|
public void shuffle()
|
|
public boolean occurrences(int max)
|
|
public Card getMax()
|
|
}
|
|
|
|
class Card {
|
|
int number;
|
|
Suit suit;
|
|
|
|
public Card(int number, Suit suit)
|
|
}
|
|
```
|