package cn.kgc.demo.ddz; import java.util.*; public class Paixing { public static void main(String[] args) { // hashMap集合来存储key,牌型。 HashMap pai = new HashMap<>(); // 存花色 String[] color=new String[]{"♠","♥","♣","♦"}; // 存数字 String[] nums=new String[]{"A","2","3","4","5","6","7","8","9","10","J","Q","K"}; // 设置key变量 int index; // 存大小王 pai.put(0,"大王"); pai.put(1,"小王"); // 存牌型 index=2; for(int i=0;i al = new ArrayList<>(); Set set = pai.keySet(); for(Integer key:set){ al.add(pai.get(key)); } Collections.shuffle(al); System.out.println(al); // 发牌 三个玩家玩,没人17张,底牌留三张 System.out.println("***********************************"); // 设置三个玩家 ArrayList lb = new ArrayList<>(); ArrayList zf = new ArrayList<>(); ArrayList gy = new ArrayList<>(); ArrayList dp = new ArrayList<>(); // 取牌分别发给三人 for (int i = 0; i <((color.length*nums.length)-1) ; i++) { switch (i%3){ case 0: lb.add(al.get(i)); break; case 1: zf.add(al.get(i)); break; case 2: gy.add(al.get(i)); break; } } // 设置剩余三张的底牌 for (int i=(color.length*nums.length)-1;i