Java接口ArrayList 斗地主

package lihang;

import java.util.ArrayList;
import java.util.Collections;

public class Poker {

public static void main(String[] args) {
	// TODO Auto-generated method stub

ArrayList pokerBox= new ArrayList();
ArrayList colors= new ArrayList();
ArrayList numbers= new ArrayList();
colors.add(“♥”);
colors.add(“♦”);
colors.add(“♠”);
colors.add(“♣”);
for(int i=2;i<=10;i++) {
numbers.add(i+"");
}
numbers.add(“J”);
numbers.add(“Q”);
numbers.add(“A”);
numbers.add(“K”);
for(String color : colors) {
for(String number : numbers) {
String card= color+number;
pokerBox.add(card);
}

}
pokerBox.add(“小鬼”);
pokerBox.add(“大鬼”);
Collections.shuffle(pokerBox);
ArrayList player1= new ArrayList();
ArrayList player2= new ArrayList();
ArrayList player3= new ArrayList();
ArrayList dipai= new ArrayList();
for(int i=0;i String card=pokerBox.get(i);
if(i>=51) {
dipai.add(card);
}else {
if(i%30) {
player1.add(card);
}else if(i%3
1) {
player2.add(card);
}else {
player3.add(card);
}

}

}
System.out.println(“李航:”+player1);
System.out.println(“赵子宣:”+player2);
System.out.println(“白欣达:”+player3);
System.out.println(“底牌:”+dipai);
}

}

你可能感兴趣的:(Java接口ArrayList 斗地主)