예제 #1
0
  /**
   * Create a step in the decision tree.
   *
   * @param gameMap
   * @param depth
   */
  public AIStep(GameMap gameMap, int depth) {
    this.gameMap = new GameMap(gameMap.getValues());
    this.depth = depth + 1;
    this.nextSteps = new AIStep[4];

    createNewSteps();
    rateSteps();
  }
예제 #2
0
  private void createNewSteps() {
    // check if there is a need for a new step
    if (depth >= depthMax) {
      return;
    }

    // create nextSteps for all 4 directions
    for (int i = 0; i < 4; i++) {
      // create a new game Map
      GameMap gm = new GameMap(gameMap.getValues());
      // move the game map in one direction
      gm.gameMove(i);

      nextSteps[i] = new AIStep(gm, depth);
    }
  }