-
Notifications
You must be signed in to change notification settings - Fork 0
/
Single.java
38 lines (37 loc) · 837 Bytes
/
Single.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* This class is used to model a hand of Single
*
* @author Chan Sze Wing
*
*/
public class Single extends Hand {
/**
* Building a hand of Single with a player and their chosen list of cards
*
* @param player the index of player
* @param cards the list of selected cards
*/
public Single(CardGamePlayer player, CardList cards) {
super(player, cards);
}
/**
* Check if the hand is a valid Single hand
*
* @return true if the hand is Single, otherwise false
*/
public boolean isValid() {
if (this.size() == 1) {
return true;
} else {
return false;
}
}
/**
* Return the hand's type
*
* @return the string "Single"
*/
public String getType() {
return "Single";
}
}