Example #1
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);
    }
  }
Example #2
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();
  }
Example #3
0
 private boolean inEdge(ContentBox cbox) {
   return (cbox.getXpos() == 0 || cbox.getXpos() == gameMap.getGameSize() - 1)
       && (cbox.getYpos() == 0 || cbox.getYpos() == gameMap.getGameSize() - 1);
 }