package com.ntqingniao.j96;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Client {
public static void main(String[] args) {
List pokers=new ArrayList();
for(String follow:Constants.FOLLOWS) {
for (int number : Constants.NUMBERS) {
Poker poker=new Poker(follow,number);
pokers.add(poker);
}
}
// int i = 0;
// for (Poker poker : pokers) {
// System.out.print(poker + ” “);
// i++;
// if (i % 13 == 0) {
// System.out.println();
// }
// }
//
// System.out.println(“==========洗牌==========”);
//
// Collections.shuffle(pokers);
// i = 0;
// for (Poker poker : pokers) {
// System.out.print(poker + ” “);
// i++;
// if (i % 13 == 0) {
// System.out.println();
// }
// }
Player p1 = new Player();
p1.setName(“张三”);
Player p2 = new Player();
p2.setName(“李四”);
Player p3 = new Player();
p3.setName(“王五”);
Player p4 = new Player();
p4.setName(“钱六”);
//创建四个pokers集合用于分别存放四个玩家的牌
List<Poker> pokers1 = new ArrayList<Poker>();
List<Poker> pokers2 = new ArrayList<Poker>();
List<Poker> pokers3 = new ArrayList<Poker>();
List<Poker> pokers4 = new ArrayList<Poker>();
Collections.shuffle(pokers);
int j=0;
for (Poker poker : pokers) {
if(j/13==0) {
pokers1.add(poker);
} else if (j/13==1) {
pokers2.add(poker);
} else if (j/13==2) {
pokers3.add(poker);
} else {
pokers4.add(poker);
}
j++;
}
Collections.sort(pokers1);
Collections.sort(pokers2);
Collections.sort(pokers3);
Collections.sort(pokers4);
p1.setPokers(pokers1);
p2.setPokers(pokers2);
p3.setPokers(pokers3);
p4.setPokers(pokers4);
System.out.println(p1.getName()+p1.getPokers());
System.out.println(p2.getName()+p2.getPokers());
System.out.println(p3.getName()+p3.getPokers());
System.out.println(p4.getName()+p4.getPokers());
}
}