コード例 #1
0
  public static Estimation calculateEstimation(MorrisBoard bd) {
    Estimation est = new IntegerEstimation();
    int numWhite = bd.countWhite();
    int numBlack = bd.countBlack();

    MorrisBoard swapBoard = bd.swap();
    List<MorrisBoard> blackMoves = generateAction(swapBoard);
    int numBlackMoves = blackMoves.size();

    int estValue = IntegerEstimation.NOTSET;
    if (numBlack <= 2) {
      estValue = IntegerEstimation.WIN;
    } else {
      if (numWhite <= 2) {
        estValue = IntegerEstimation.LOSE;
      } else {
        if (numBlackMoves == 0) {
          estValue = IntegerEstimation.WIN;
        } else {
          estValue = 1000 * (numWhite - numBlack) - numBlackMoves;
        }
      }
    }

    est.setValue(estValue);
    return est;
  }