标签:cti 游戏 class util 玩家 for public sde dem
import java.util.ArrayList;
import java.util.Collections;
public class Collectionsdemo {
public static void main(String[] args) {
//买牌
String []arr={"黑桃","红桃","方片","梅花"};
String []arr2={"A","1","2","3","4","5","6","7","8","9","10","J","Q","K"};
//模拟发牌
ArrayList<String> box=new ArrayList<String>();
//添加每张牌 获取花色
for (int i = 0; i < arr.length; i++) {
//获取牌号
for (int j = 0; j < arr2.length; j++) {
box.add(arr[i]+arr2[j]);
}
}
box.add("大王");
box.add("小王");
//洗牌
Collections.shuffle(box);
//发牌
ArrayList<String>利亚东=new ArrayList<String>();
ArrayList<String>超超=new ArrayList<String>();
ArrayList<String>玩家1=new ArrayList<String>();
for (int i = 0; i < box.size()-3; i++) {
if(i%3==0){
利亚东.add(box.get(i));
}else if(i%3==1){
超超.add(box.get(i));
}else if(i%3==2){
玩家1.add(box.get(i));
}
}
System.out.println("利亚东\t"+利亚东+"\n");
System.out.println("超超\t"+超超+"\n");
System.out.println("玩家1\t"+玩家1+"\n");
System.out.println("底牌");
/*System.out.println(box.get(box.size()-1));
System.out.println(box.get(box.size()-2));
System.out.println(box.get(box.size()-3));*/
for (int i = box.size()-3; i < box.size(); i++) {
System.out.println(box.get(i));
}
}
}
标签:cti 游戏 class util 玩家 for public sde dem
原文地址:https://www.cnblogs.com/liyado/p/10618402.html