|
@@ -363,25 +363,21 @@ public final class GDUtils {
|
|
|
*/
|
|
|
private static int comparePairSequence(List<Integer> previousPoints, List<Integer> currentPoints, int curLevel, int wildCardCountCurrent, int wildCardCountPrevious) {
|
|
|
|
|
|
- List<Integer> adjustedPrevious = replaceWildCardsWithTrump(previousPoints, wildCardCountPrevious, curLevel, 2);
|
|
|
- List<Integer> adjustedCurrent = replaceWildCardsWithTrump(currentPoints, wildCardCountCurrent, curLevel, 2);
|
|
|
+ List<Integer> adjustedPrevious = replaceWildCardsWithTrump(previousPoints, wildCardCountPrevious, curLevel, 6);
|
|
|
+ List<Integer> adjustedCurrent = replaceWildCardsWithTrump(currentPoints, wildCardCountCurrent, curLevel, 6);
|
|
|
|
|
|
-
|
|
|
- int maxPrevious = getPairValue(adjustedPrevious);
|
|
|
- int maxCurrent = getPairValue(adjustedCurrent);
|
|
|
+
|
|
|
+ int maxPrevious = getMaxConsecutiveValue(adjustedPrevious);
|
|
|
+ int maxCurrent = getMaxConsecutiveValue(adjustedCurrent);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
boolean previousIsTrump = (maxPrevious == curLevel);
|
|
|
boolean currentIsTrump = (maxCurrent == curLevel);
|
|
|
|
|
|
- if (currentIsTrump && !previousIsTrump) {
|
|
|
- return 1;
|
|
|
- }
|
|
|
- if (!currentIsTrump && previousIsTrump) {
|
|
|
- return -1;
|
|
|
- }
|
|
|
+ if (currentIsTrump && !previousIsTrump) return 1;
|
|
|
+ if (!currentIsTrump && previousIsTrump) return -1;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
return Integer.compare(maxCurrent, maxPrevious);
|
|
|
}
|
|
|
|
|
@@ -416,11 +412,11 @@ public final class GDUtils {
|
|
|
List<Integer> adjustedPrevious = replaceWildCardsWithTrump(previousPoints, wildCardCountPrevious, curLevel, 2);
|
|
|
List<Integer> adjustedCurrent = replaceWildCardsWithTrump(currentPoints, wildCardCountCurrent, curLevel, 2);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
int maxPreviousPair = getPairValue(adjustedPrevious);
|
|
|
int maxCurrentPair = getPairValue(adjustedCurrent);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
boolean previousIsTrumpPair = (maxPreviousPair == curLevel);
|
|
|
boolean currentIsTrumpPair = (maxCurrentPair == curLevel);
|
|
|
|
|
@@ -466,15 +462,15 @@ public final class GDUtils {
|
|
|
* @return 正数表示当前牌较大,负数表示上一手牌较大,0表示相等
|
|
|
*/
|
|
|
private static int compareTriple(List<Integer> previousPoints, List<Integer> currentPoints, int curLevel, int wildCardCountCurrent, int wildCardCountPrevious) {
|
|
|
-
|
|
|
+
|
|
|
List<Integer> adjustedPrevious = replaceWildCardsWithTrump(previousPoints, wildCardCountPrevious, curLevel, 3);
|
|
|
List<Integer> adjustedCurrent = replaceWildCardsWithTrump(currentPoints, wildCardCountCurrent, curLevel, 3);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
int maxPreviousTriple = getMaxFrequencyCard(adjustedPrevious, 3);
|
|
|
int maxCurrentTriple = getMaxFrequencyCard(adjustedCurrent, 3);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
boolean previousIsTrumpTriple = (maxPreviousTriple == curLevel);
|
|
|
boolean currentIsTrumpTriple = (maxCurrentTriple == curLevel);
|
|
|
|
|
@@ -485,7 +481,7 @@ public final class GDUtils {
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
return Integer.compare(maxCurrentTriple, maxPreviousTriple);
|
|
|
}
|
|
|
|
|
@@ -559,25 +555,23 @@ public final class GDUtils {
|
|
|
* @return 正数表示当前牌较大,负数表示上一手牌较大,0表示相等
|
|
|
*/
|
|
|
private static int compareThreeConsecutive(List<Integer> previousPoints, List<Integer> currentPoints, int curLevel, int wildCardCountCurrent, int wildCardCountPrevious) {
|
|
|
-
|
|
|
+
|
|
|
List<Integer> adjustedPrevious = replaceWildCardsWithTrump(previousPoints, wildCardCountPrevious, curLevel, 6);
|
|
|
List<Integer> adjustedCurrent = replaceWildCardsWithTrump(currentPoints, wildCardCountCurrent, curLevel, 6);
|
|
|
|
|
|
-
|
|
|
- int previousStrength = calculateHandStrength(adjustedPrevious, wildCardCountPrevious);
|
|
|
- int currentStrength = calculateHandStrength(adjustedCurrent, wildCardCountCurrent);
|
|
|
+
|
|
|
+ int maxPrevious = getMaxConsecutiveValue(adjustedPrevious);
|
|
|
+ int maxCurrent = getMaxConsecutiveValue(adjustedCurrent);
|
|
|
|
|
|
-
|
|
|
- if (currentStrength > previousStrength) {
|
|
|
- return 1;
|
|
|
- }
|
|
|
-
|
|
|
- if (currentStrength < previousStrength) {
|
|
|
- return -1;
|
|
|
- }
|
|
|
+
|
|
|
+ boolean previousIsTrump = (maxPrevious == curLevel);
|
|
|
+ boolean currentIsTrump = (maxCurrent == curLevel);
|
|
|
+
|
|
|
+ if (currentIsTrump && !previousIsTrump) return 1;
|
|
|
+ if (!currentIsTrump && previousIsTrump) return -1;
|
|
|
|
|
|
-
|
|
|
- return compareByPoints(adjustedPrevious, adjustedCurrent);
|
|
|
+
|
|
|
+ return Integer.compare(maxCurrent, maxPrevious);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -660,11 +654,23 @@ public final class GDUtils {
|
|
|
* @return 正数表示当前牌较大,负数表示上一手牌较大,0表示相等
|
|
|
*/
|
|
|
private static int compareStraight(List<Integer> previousPoints, List<Integer> currentPoints, int curLevel, int wildCardCountCurrent, int wildCardCountPrevious) {
|
|
|
-
|
|
|
+
|
|
|
List<Integer> adjustedPrevious = replaceWildCardsWithTrump(previousPoints, wildCardCountPrevious, curLevel, 5);
|
|
|
List<Integer> adjustedCurrent = replaceWildCardsWithTrump(currentPoints, wildCardCountCurrent, curLevel, 5);
|
|
|
+
|
|
|
+ int minPreviousStraight = getMinStraightValue(adjustedPrevious);
|
|
|
+ int minCurrentStraight = getMinStraightValue(adjustedCurrent);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ if (minCurrentStraight > minPreviousStraight) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (minCurrentStraight < minPreviousStraight) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
int maxPreviousStraight = getMaxStraightValue(adjustedPrevious);
|
|
|
int maxCurrentStraight = getMaxStraightValue(adjustedCurrent);
|
|
|
|
|
@@ -677,11 +683,8 @@ public final class GDUtils {
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- int minPreviousStraight = getMinStraightValue(adjustedPrevious);
|
|
|
- int minCurrentStraight = getMinStraightValue(adjustedCurrent);
|
|
|
-
|
|
|
- return Integer.compare(minCurrentStraight, minPreviousStraight);
|
|
|
+
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
|