public class Poker_GameDemo {
public static void main(String[] args) {
String[] num = { "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q",
"K", "A", "2" };
String[] color = { "♠", "♥", "♣", "♦" };
HashMap<Integer, String> poker = new HashMap<>();
ArrayList<Integer> list = new ArrayList<>();
TreeSet<Integer> one = new TreeSet<>();
TreeSet<Integer> two = new TreeSet<>();
TreeSet<Integer> three = new TreeSet<>();
TreeSet<Integer> other = new TreeSet<>();
int x = 0;
for (int j = 0; j < num.length; j++) {
for (int i = 0; i < color.length; i++) {
list.add(x);
poker.put(x, color[i] + num[j]);
x++;
}
}
poker.put(x, "小王");
list.add(x);
x++;
poker.put(x, "大王");
list.add(x);
Collections.shuffle(list);
for (int i = 0; i < list.size(); i++) {
if (i >= list.size() - 3) {
other.add(list.get(i));
} else if (i % 3 == 1) {
one.add(list.get(i));
} else if (i % 3 == 2) {
two.add(list.get(i));
} else {
three.add(list.get(i));
}
}