public class Poker
{
private String tag; // 图片扑克花色的表示(代表的是红桃、黑桃,梅花、方块
private int num; // 表示扑克牌面的大
public Poker(String tag, int num)
{
this.num = num;
this.tag = tag;
}
public int getNum()
{
return num;
}
public void setNum(int num)
{
this.num = num;
}
public void setTag(String tag)
{
this.tag = tag;
}
public String getTag()
{
return tag;
}
public String toString()
{
return " tag: " + this.tag +" num: " + this.num;
}
}
private static Map<Integer, List> SevenToFiveGroups(List map)
{
Map<Integer, List> group = new HashMap<Integer, List>();
int num = 0;
for (int a = 0; a < 3; a++)
{
for (int b = a + 1; b < 4; b++)
{
for (int c = b + 1; c < 5; c++)
{
for (int d = c + 1; d < 6; d++)
{
for (int e = d + 1; e < 7; e++)
{
List pukeGroup = new ArrayList();
pukeGroup.add(map.get(a));
pukeGroup.add(map.get(b));
pukeGroup.add(map.get©);
pukeGroup.add(map.get(d));
pukeGroup.add(map.get(e));
group.put(num++, pukeGroup);
}
}
}
}
}
num = 0;
return group;
}
int Pukelevel = -1;
int flag = 0;
for (int i = 0; i < list.size(); i++)
{
for (int j = i + 1; j < list.size(); j++)
{
if (list.get(i).getNum() == list.get(j).getNum())
{
flag++;
}
}
}
switch (flag)
{
case 6:
四条
case 4:
葫芦
case 3:
三条
case 2:
两队
case 1:
一对
case 0:
高牌
}
this.level即牌型, 就是这样计算出来的,然后就是计算这副手牌的大小了!
long lon = 1000000000L * 10;
this.pkValue = 0L;
for(int i = 0 ; i < this.list.size() ; i++)
{
int interval = 1;
for(int j = i ; j < this.list.size() - 1 ; j ++)
{
interval *= 10;
interval *= 10;
}
this.pkValue += this.list.get(i).getNum() * interval;
}
this.pkValue += this.level * lon;