public static void main(String[] args) {
List<String> poker = new ArrayList<>();
String[] color = {"♠", "♥", "♦", "♣"};
String[] number = {"2", "A", "K", "Q", "J", "10", "9", "8", "7", "6", "5", "4", "3"};
for (int i = 0; i < color.length; i++) {
for (int i1 = 0; i1 < number.length; i1++) {
poker.add(color[i] + number[i1]);
}
}
poker.add("大王");
poker.add("小王");
Collections.shuffle(poker);
//System.out.println(poker);
List<String> play01 = new ArrayList<>();
List<String> play02 = new ArrayList<>();
List<String> play03 = new ArrayList<>();
List<String> dipai = new ArrayList<>();
for (int i = 0; i < poker.size(); i++) {
if (i > 50) {
dipai.add(poker.get(i));
} else if (i % 3 == 0) {
play01.add(poker.get(i));
} else if (i % 3 == 1) {
play02.add(poker.get(i));
} else if (i % 3 == 2) {
play03.add(poker.get(i));
}
}
System.out.println(play01);
System.out.println(play02);
System.out.println(play03);
System.out.println(dipai);
}
斗地主(综合案例)
最新推荐文章于 2023-08-20 19:53:12 发布