e0bf57dbacfb001c1573b62be8af1246
来自「Svm based face detector code」· 代码 · 共 63 行
TXT
63 行
package com.sans.ninemen.core;
/**
* This class has the static estimator functions for opening,Mid End game and also Improved heuristic
* @author sanshack
*
*/
public class StaticEstimator {
/**
* This is the static estimation function for the opening
* @param x
* @return heuristic value
*/
public static int defaultEstimator(String x) {
int numWhitePieces = Utility.countChar(x, 'W');
int numBlackPieces = Utility.countChar(x, 'B');
return (numWhitePieces - numBlackPieces);
}
/**
* This is the static estimation for Mid End game
* @param x
* @param numBlackMoves
* @return heuristic value
*/
public static int midEndGameEstimator(String x,int numBlackMoves) {
int numWhitePieces = Utility.countChar(x, 'W');
int numBlackPieces = Utility.countChar(x, 'B');
if(numBlackPieces<=2) {
return (10000);
} else if(numWhitePieces<=2) {
return(-10000);
} else if(numBlackMoves ==0 ) {
return(10000);
} else {
return (1000*(numWhitePieces - numBlackPieces) - numBlackMoves);
}
}
/**
* This is the impoved static estimation function for both opening and midendgame
* @param x
* @param numBlackMoves
* @param numWhiteMoves
* @return heuristic value
*/
public static int midEndGameEstimatorImproved(String x,int numBlackMoves,int numWhiteMoves) {
int numWhitePieces = Utility.countChar(x, 'W');
int numBlackPieces = Utility.countChar(x, 'B');
if(numBlackPieces<=2) {
return (10000);
} else if(numWhitePieces<=2) {
return(-10000);
} else if(numBlackMoves ==0 ) {
return(10000);
} else {
return (100*(numWhitePieces - numBlackPieces) + (numWhiteMoves-numBlackMoves));
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?