forked from JeffSPeterson/PokerGame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadIn.java
More file actions
66 lines (55 loc) · 1.51 KB
/
Copy pathReadIn.java
File metadata and controls
66 lines (55 loc) · 1.51 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package peterson;
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
public class ReadIn {
public final static int ACE = 1;
public final static int TEN = 10;
public final static int JACK = 11;
public final static int QUEEN = 12;
public final static int KING = 13;
public final static int SPADE = 20;
public final static int HEART = 21;
public final static int DIAMOND = 22;
public final static int CLUB = 23;
Scanner scan = new Scanner(new File("hands.txt"));
String str;
int d, s, count = 0;
Card[] cards = new Card[5];
Card card;
Hand p1Hand;
Hand p2Hand;
public ReadIn() throws IOException {
// ////////READ IN FILE//////////////////////////
while (scan.hasNext()) {
str = scan.next();
// ///////// IF 10, J, K, Q, A TURN INTO
// INTO/////////////////////////
if (str.substring(0, 1).equals("T"))
d = TEN;
else if (str.substring(0, 1).equals("J"))
d = JACK;
else if (str.substring(0, 1).equals("Q"))
d = QUEEN;
else if (str.substring(0, 1).equals("K"))
d = KING;
else if (str.substring(0, 1).equals("A"))
d = ACE;
else
d = Integer.parseInt(str.substring(0, 1));
// ///////// TURN SUIT INTO INT ///////////////
if (str.substring(1).equals("S"))
s = SPADE;
else if (str.substring(1).equals("H"))
s = HEART;
else if (str.substring(1).equals("D"))
s = DIAMOND;
else
s = CLUB;
// NEW CARD FROM INPUT
card = new Card(d, s);
System.out.println(card.digit + " " + card.suit);
}
scan.close();
}
}