package itheima_02;
import java.util.ArrayList;
import java.util.Collections;
public class pockDemo {
public static void main(String[] args) {
ArrayList<String> array = new ArrayList<String>();
String[] colors = {"A", "A", "A", };
String[] numbers = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "k", "A"};
for (String color : colors) {
for (String number : numbers) {
array.add(color + number);
}
}
array.add("小王");
array.add("大王");
Collections.shuffle(array);
ArrayList<String> lqxArray = new ArrayList<String>();
ArrayList<String> lyArray = new ArrayList<String>();
ArrayList<String> fqyArray = new ArrayList<String>();
ArrayList<String> dpArray = new ArrayList<String>();
for (int i = 0; i < array.size(); i++) {
String poker = array.get(i);
if (i > array.size() - 3) {
dpArray.add(poker);
} else if (i % 3 == 0) {
lqxArray.add(poker);
} else if (i % 3 == 1) {
lqxArray.add(poker);
} else if (i % 3 == 2) {
fqyArray.add(poker);
}
}
loopoker("林青霞", lqxArray);
loopoker("刘耀", lyArray);
loopoker("风清扬", fqyArray);
loopoker("底牌", dpArray);
}
public static void loopoker(String name, ArrayList<String> array) {
System.out.println(name + "的牌是:");
for (String poker : array) {
System.out.println(poker + "");
}
System.out.println();
}
}