package eu.semberal.migmang.logic;
import eu.semberal.migmang.enums.GameColor;
import java.util.Random;
/**
* Class with board evaluation functionality
*
* @author lukas.sembera
*/
public class Evaluation {
private static Random random;
private static final int MULTIPLICATION_COEFICIENT = 10000;
static {
random = new Random();
}
/**
* Evaluates a position for specific player
*/
public static int evaluateBoard(Board board, GameColor color) {
GameColor otherColor = (color == GameColor.White ? GameColor.Black : GameColor.White);
int ret = 15 - board.getPiecesCount(otherColor);
ret += board.getPiecesCount(color);
ret *= MULTIPLICATION_COEFICIENT;
ret += random.nextInt(MULTIPLICATION_COEFICIENT - 1);
return ret;
}
}