-
Notifications
You must be signed in to change notification settings - Fork 0
/
CardTests.java
80 lines (63 loc) · 2.19 KB
/
CardTests.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package jtj_holdem.tests.misc;
import java.util.ArrayList;
import java.util.List;
import jtj_holdem.game.data.Card;
import jtj_holdem.game.data_structures.CardDeck;
import jtj_holdem.game.data_structures.PokerHand;
import jtj_holdem.game.enums.ECardNumber;
import jtj_holdem.game.enums.ECardSuit;
import jtj_holdem.game.interfaces.ICard;
import jtj_holdem.game.utility.PokerHandUtility;
public class CardTests {
public static void main(String[] args) {
/**
* Need to change this to use JUnit.
*/
System.out.println("Creating Deck...");
CardDeck deck = new CardDeck();
deck.populateDeck(false);
System.out.println("Deck before shuffle");
deck.printDeck();
deck.shuffleDeck();
System.out.println("###################################");
System.out.println("Deck after shuffle");
deck.printDeck();
System.out.println("####################################");
System.out.println("Deal a Card to me.....");
System.out.println(deck.dealCard());
System.out.println("Deal another card......");
System.out.println(deck.dealCard());
List<ICard> aHand = new ArrayList<ICard>();
for (int i = 0; i < 7; i++){
ICard card = deck.dealCard();
// System.out.println("dealing card: " + card);
aHand.add(card);
}
System.out.println("Checking my HAND1!!!...");
PokerHand hand = PokerHandUtility.determineBestHand(aHand);
System.out.println(hand.getHand());
System.out.println(hand.getCards());
System.out.println(hand.getKickers());
List<ICard> aHand2 = new ArrayList<ICard>();
for (int i = 0; i < 7; i++){
ICard card = deck.dealCard();
//System.out.println("dealing card2: " + card);
aHand2.add(card);
}
System.out.println("Checking my HAND2!!!...");
PokerHand hand2 = PokerHandUtility.determineBestHand(aHand2);
System.out.println(hand2.getHand());
System.out.println(hand2.getCards());
System.out.println(hand2.getKickers());
System.out.println("Which hand wins???");
int winner = hand.compareTo(hand2);
System.out.println(winner);
if (winner > 0){
System.out.println("Hand 1 Wins!!!!");
}else if (winner < 0){
System.out.println("Hand 2 Wins!!!!");
}else{
System.out.println("They are equal Split...");
}
}
}