summaryrefslogtreecommitdiff
path: root/aux/set/CardSet.java
diff options
context:
space:
mode:
Diffstat (limited to 'aux/set/CardSet.java')
-rw-r--r--aux/set/CardSet.java50
1 files changed, 31 insertions, 19 deletions
diff --git a/aux/set/CardSet.java b/aux/set/CardSet.java
index 8df6055..56a998d 100644
--- a/aux/set/CardSet.java
+++ b/aux/set/CardSet.java
@@ -15,9 +15,9 @@ public class CardSet {
36, 38, 40, 42, 44, 46, 48, 50, 52,
68, 70, 72, 74, 76, 78, 80, 82, 84,
100,106,112,118,
- 132,138,144,146
+ 132,138,144,148
};
- private static final int[] id2OrdLut = new int[]
+ public static final int[] id2OrdLut = new int[]
{
34, 34, 0, 1, 2, 3, 4, 5, 6, 7, 8, 34, 34, 34, 34, 34,
34, 34, 9, 10, 11, 12, 13, 14, 15, 16, 17,34, 34, 34, 34, 34,
@@ -49,11 +49,11 @@ public class CardSet {
cardRem[getOrd(card.getStdId())]+=mult;
}
- protected int std2Id(int std)
+ public static int std2Id(int std)
{
return std>>1;
}
- protected int getOrd(int id)
+ public static int getOrd(int id)
{
return id2OrdLut[std2Id(id)];
}
@@ -68,24 +68,36 @@ public class CardSet {
private int cnt=0;
- public int calTing()
+ public int calTing(int mian)
{
//cnt=0;
- int res=calTing(0,cardRem[0],0,0,0);
+ int res=calTing(0,cardRem[0],0,0,mian);
//System.out.println(cnt);
return res;
}
- private int nextCardOrd(int i)
+ public static int nextCardOrd(int i)
{
return getOrd(deckIds[i]+2);
}
- private int next2CardOrd(int i)
+ public static int next2CardOrd(int i)
{
return nextCardOrd(nextCardOrd(i));
}
+ public static int prevCardOrd(int i)
+ {
+ return getOrd(deckIds[i]-2);
+ }
+
+ public static int prev2CardOrd(int i)
+ {
+ return prevCardOrd(prevCardOrd(i));
+ }
+
+ public int cardLeft(int ord){ return cardRem[ord]; }
+
private int calTing(int pos,int rems,int shoupai,int ting, int mian)
{
//++cnt;
@@ -141,17 +153,17 @@ public class CardSet {
return Math.min(6-shoupai,res);
}
- public Vector<Card> jinZhang()
+ public Vector<Card> jinZhang(int mian)
{
Vector<Card> cards = new Vector<Card>();
int res=0;
- int ref=calTing();
+ int ref=calTing(mian);
for (int i=0;i<cardTypeTotal;++i)
if (cardRem[i]<3)
{
Card card=new Card(deckIds[i]);
add(card,1);
- if (calTing()<ref) {
+ if (calTing(mian)<ref) {
++res;
cards.add(card);
}
@@ -160,19 +172,19 @@ public class CardSet {
return cards;
}
- public Vector<Card> ameliorate()
+ public Vector<Card> ameliorate(int mian)
{
Vector<Card> cards = new Vector<Card>();
int res=0;
- int ref=calTing();
- int jinref=jinZhang().size();
+ int ref=calTing(mian);
+ int jinref=jinZhang(mian).size();
for (int i=0;i<cardTypeTotal;++i)
if (cardRem[i]<3)
{
Card card=new Card(deckIds[i]);
add(card,1);
- if (calTing()==ref) {
- if (maxJinZhang(ref)>jinref) {
+ if (calTing(mian)==ref) {
+ if (maxJinZhang(mian,ref)>jinref) {
++res;
cards.add(card);
//System.out.println(card.getNormalName());
@@ -183,15 +195,15 @@ public class CardSet {
return cards;
}
- public int maxJinZhang(int xt)
+ public int maxJinZhang(int mian,int xt)
{
int res=0;
for (int i=0;i<cardTypeTotal;++i)
if (cardRem[i]>0)
{
--cardRem[i];
- if (calTing()==xt)
- res=Math.max(res,jinZhang().size());
+ if (calTing(mian)==xt)
+ res=Math.max(res,jinZhang(mian).size());
++cardRem[i];
}
return res;