首先定义一个卡牌类
public class Card {
private String numb;
private String color;
private int index;
public Card() {
}
public Card(String numb, String color, int index) {
this.numb = numb;
this.color = color;
this.index = index;
}
public String getNumb() {
return numb;
}
public void setNumb(String numb) {
this.numb = numb;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
@Override
public String toString() {
return color+numb;
}
}
然后是控制类
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class Controller {
private static List<Card> cards = new ArrayList<Card>();
static {//准备新牌
String[] numbs = new String[]{"3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A", "2"};
// 1 2 3
String[] colors = new String[]{"♠", "♡", "♢", "♣"};
String[] kings = new String[]{"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)