Example #1
0
  // Edge case: As we're approaching the end of a sequence, try to maximise score...
  // Possible change to ncombinable: Weight combinables that increase the score significantly
  private int evaluate(Board b) {
    int[] thefactors = currentfactors;

    // We are close to the end of the sequence! Use different weights!
    if (b.nMoves() + MAX_DEPTH * 2 >= tileSequence.length) {
      // System.err.println(b.nMoves());
      thefactors = closefactors;
    }
    return ((int) Math.pow(4, b.dof()))
        + thefactors[0] * b.zeros()
        + thefactors[1] * b.checkerboarding3()
        + thefactors[2] * b.smoothness()
        + thefactors[3] * b.nCombinable();
  }