📄 f17555dbacfb001c1573b62be8af1246
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -