コード例 #1
0
  /*
   * the depth is related with the number of empty position(hopping) or empty neighbor(move).
   * the more the empty is, the more the possible children of each node, so the less the appropriate depth
   */
  public static int determinApproporiateDepth(MorrisBoard bd) {
    int depth = SEARCH_DEP_LIMIT_DEFAULT;
    int numWhite = bd.countWhite();
    if (numWhite < 3) {
      depth = UNVALIED;
    } else if (numWhite == 3) {
      depth = 3;
    } else {
      int numEmpty = bd.countEmpty();
      if ((numEmpty >= HIGH_BOTTOM) && (numEmpty <= HIGH_TOP)) {
        depth = depthForHigh(numEmpty);
      } else if ((numEmpty >= MED_BOTTOM) && (numEmpty <= MED_TOP)) {
        depth = depthForMed(numEmpty);
      } else if ((numEmpty >= LOW_BOTTOM) && (numEmpty <= LOW_TOP)) {
        depth = depthForLow(numEmpty);
      }
    }

    return depth;
  }