-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSingle.java
More file actions
47 lines (42 loc) · 1.23 KB
/
Single.java
File metadata and controls
47 lines (42 loc) · 1.23 KB
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
39
40
41
42
43
44
45
46
47
/**
* This class is used to represent a single in the Big Two game. This hand consists of only one single card. The only card in a single is referred to as the top card of this single. A single with a higher rank beats a single with a lower rank.
*
* @author Lakhani, Amsal Murad
*
*/
public class Single extends Hand {
/**
* Creates and returns an instance of the Single class.
*
* @param player
* The player that has played this hand of single.
* @param cards
* The hand of single that the player has played.
*/
public Single(CardGamePlayer player, CardList cards) {
super(player, cards);
}
/**
* It overrides the abstract method isValid of the Hand class. Checks if this hand is a valid single in the Big Two game.
*
* @return
* A boolean value of true if this hand is a valid single. Returns false otherwise.
*
*/
public boolean isValid() {
if (this.size() == 1) {
return true;
}
return false;
}
/**
* It overrides the abstract method getType of the Hand class. Gets the type of the hand played.
*
* @return
* A string of the type of the hand played. A single in this case.
*
*/
public String getType() {
return "Single";
}
}