JAVA
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
// Language: Java
// Task Description: Fix the code so each player has only 2 cards at the beginning of the game. Then add the table (shared) cards. Based on the table and hand cards, announce the winner. (Hint: You can take a look at the Texas Holdem rules)
import java.util.ArrayList;
import java.util.Collections;
public class PokerGame {
public static void main(String[] args) {
Deck deck = new Deck();
// Shuffle the deck
deck.shuffle();
int players = 4; // number of players
// Deal the cards and show results
for (int i = 1; i <= players; i++) {
Hand hand = new Hand(deck);
System.out.println("PLAYER " + i + ":");
hand.showCards();
hand.showResult();
System.out.println();
}
}
}
class Card {
short rank, suit;
String[] suits = {"Hearts", "Spades", "Diamonds", "Clubs"};
Enter to Rename, Shift+Enter to Preview
OUTPUT
Laufen