Exemplo n.º 1
0
  public GameLogic(
      int totalSteps,
      int pathCredits,
      int calcCredits,
      TiliaCollection collectionBlue,
      TiliaCollection collectionRed,
      GUI gui,
      String map,
      double speed,
      GameLogic.AGENT_STRATEGY blueTeamPathStrategy,
      GameLogic.AGENT_STRATEGY redTeamPathStrategy,
      GameLogic.PROCESSING_STRATEGY blueProcStrategy,
      GameLogic.PROCESSING_STRATEGY redProcStrategy) {

    this.totalSteps = totalSteps;
    this.pathCredits = pathCredits;
    this.calcCredits = calcCredits;
    this.collectionBlue = collectionBlue;
    this.collectionRed = collectionRed;
    this.gui = gui;
    this.map = map;
    this.speed = speed;
    this.blueTeamPathStrategy = blueTeamPathStrategy;
    this.redTeamPathStrategy = redTeamPathStrategy;
    this.blueProcStrategy = blueProcStrategy;
    this.redProcStrategy = redProcStrategy;

    this.coinLocations = new HashMap<Integer, Integer>();
    for (String x : Tile.tiletypes) {
      mapper.put(x, new Tile(x));
    }

    this.squaresX = gui.getButtonsX();
    this.squaresY = gui.getButtonsY();
    this.gridIdentifier = new Tile[squaresX * squaresY];

    // read map from file
    readFromFile(gridIdentifier, map);

    for (Agent a : redTeam) {
      a.setCampLocation(redCamp);
    }

    for (Agent a : blueTeam) {
      a.setCampLocation(blueCamp);
    }

    this.processingBlue = -1;
    this.processingRed = -1;

    initialize_coins();
    // map preprocessing
    cluster1Nodes = new ArrayList<Node>();
    cluster2Nodes = new ArrayList<Node>();
    cluster3Nodes = new ArrayList<Node>();
    cluster4Nodes = new ArrayList<Node>();
    cluster5Nodes = new ArrayList<Node>();
    cluster6Nodes = new ArrayList<Node>();
    cluster7Nodes = new ArrayList<Node>();
    cluster8Nodes = new ArrayList<Node>();
    cluster9Nodes = new ArrayList<Node>();
    cluster10Nodes = new ArrayList<Node>();
    cluster11Nodes = new ArrayList<Node>();
    cluster12Nodes = new ArrayList<Node>();
    cluster13Nodes = new ArrayList<Node>();
    cluster14Nodes = new ArrayList<Node>();
    cluster15Nodes = new ArrayList<Node>();
    cluster16Nodes = new ArrayList<Node>();
    cluster17Nodes = new ArrayList<Node>();
    cluster18Nodes = new ArrayList<Node>();
    cluster19Nodes = new ArrayList<Node>();
    cluster20Nodes = new ArrayList<Node>();
    allNodes = new ArrayList<ArrayList<Node>>();
  }