package cn.zhuobo.day10.Doudizhu;
import java.util.ArrayList;
import java.util.Collections;
/*
斗地主案例
1.准备牌
2.洗牌
3.发配
4.看牌
*/
public class Doudizhu {
public static void main(String[] args) {
ArrayList<String> pokers = new ArrayList<>();
ArrayList<String> player1 = new ArrayList<>();
ArrayList<String> player2 = new ArrayList<>();
ArrayList<String> player3 = new ArrayList<>();
ArrayList<String> cardOnTable = new ArrayList<>();
String[] graphs = {"♠", "♥", "♣", "♦"};
String[] numbers = {"2", "A", "K", "Q", "J", "10", "9", "8", "7", "6", "5", "4", "3"};
for(String graph: graphs) {
for(String number: numbers) {
String poker = graph + number;
pokers.add(poker);
}
}
pokers.add("Red Joker");
pokers.add("Black Joker");
System.out.println(pokers);
Collections.shuffle(pokers);
System.out.println(pokers);
for (int i = 0; i < pokers.size(); i++) {
if(i >= 51) {
cardOnTable.add(pokers.get(i));
}
else if(i % 3 == 0) {
player1.add(pokers.get(i));
}
else if(i % 3 == 1) {
player2.add(pokers.get(i));
}
else if(i % 3 == 2) {
player3.add(pokers.get(i));
}
}
System.out.println("cards on table: " + cardOnTable);
System.out.println("玩家1" + player1);
System.out.println("玩家2" + player2);
System.out.println("玩家3" + player3);
}
}