package cn.itcase.day27.demo01.demo02.demo03;
import java.util.*;
public class Doudizhu {
public static void main(String[] args) {
HashMap<Integer,String> poker = new HashMap<>();
ArrayList<Integer> pokerindex = new ArrayList<>();
List<String> colors = List.of("♠","♥","♣","♦");
List<String> pokers = List.of("2","A","k","Q","J","10","9","8","7","6","5","4","3");
Integer index = 0;
poker.put(index,"大王");
pokerindex.add(index);
index++;
poker.put(index,"小王");
pokerindex.add(index);
index++;
for(String poke : pokers){
for (String color : colors){
poker.put(index,color+poke);
pokerindex.add(index);
index++;
}
}
Collections.shuffle(pokerindex);
ArrayList<Integer> play0 = new ArrayList<>();
ArrayList<Integer> play1 = new ArrayList<>();
ArrayList<Integer> play2 = new ArrayList<>();
ArrayList<Integer> dipai = new ArrayList<>();
for (int i = 0; i < pokerindex.size(); i++) {
Integer in = pokerindex.get(i);
if(i >= 51){
dipai.add(in);
}else if(i % 3 == 0){
play0.add(in);
}else if(i % 3 == 1){
play1.add(in);
}else if(i % 3 == 2){
play2.add(in);
}
}
Collections.sort(play0);
Collections.sort(play1);
Collections.sort(play2);
demo01("周润发",poker,play0);
demo01("刘德华",poker,play1);
demo01("周星驰",poker,play2);
}
private static void demo01(String name,HashMap<Integer,String> poker,ArrayList<Integer> list) {
System.out.print(name +": ");
for(Integer key : list){
String value = poker.get(key);
System.out.print(value+" ");
}
System.out.println();
}
}