Example #1
0
  public void start(Engine engine, Side side) {
    sideOfAI = side;

    // init move Evaluator
    moveEvaluator.setAISide(side);
    moveEvaluator.setEngine(engine);
    moveEvaluator.setHaltingCondition(
        new IHaltingCondition() {

          @Override
          public void isTimeLimitReached() throws SoftTimeLimitException {
            if (resourceManager.timeLimitReached() || resourceManager.memoryLimitReached()) {
              throw new SoftTimeLimitException();
            }
          }
        });

    // init heuristics
    heuristics.setSide(side);
    heuristics.setEngine(engine);
    heuristics.setMode(IHeuristics.Mode.aggressive);
    heuristics.init();
  }
Example #2
0
  public Itself(Random rnd) {
    // create heuristics
    heuristics = new SimpleHeuristics();
    heuristics.setWeights(WeigthOwner.own, weigths(2, 10, 250, 100));
    heuristics.setWeights(WeigthOwner.enemy, weigths(0, 20, 500, 0));

    // create move evaluator
    moveEvaluator = new AlphaBetaPruning();
    moveEvaluator.setRandomEngine(rnd);
    moveEvaluator.setHeuristics(heuristics);

    // create Resource Manager
    resourceManager = new ResourceManager(TOTAL_GAMETIME, MAX_TURNS);
  }