-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhand.java
48 lines (39 loc) · 1.04 KB
/
hand.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
39
40
41
42
43
44
45
46
47
48
class hand {
private card[] cards;
private int strength = 0;
public hand() {
}
public hand(card[] starting) {
cards = starting;
}
public void discard(card toRemove) {
}
public void show() {
System.out.println(toString());
}
public void evaluate() {
sort();
}
private void sort() {
card tempCard;
for(int i=0;i<cards.length;i++) {
for(int j = i+1;j<cards.length;j++) {
if (cards[i].getValue() != 1) {
if((cards[j].getValue() > cards[i].getValue()) || (cards[j].getValue()==1)) {
tempCard = cards[j];
cards[j]=cards[i];
cards[i] = tempCard;
}
}
}
}
}
@Override
public String toString() {
String value = "";
for(int i = 0;i<cards.length;i++) {
value += cards[i].getCard()+" ";
}
return value;
}
}