Program: 157685
Project: 157685
Buggy source:
protected int simulatePriority(SimulationNode2 node,Game game,int depth,int alpha,int beta){
  if (ALLOW_INTERRUPT && Thread.interrupted()) {
    Thread.currentThread().interrupt();
    logger.info("String_Node_Str");
    return GameStateEvaluator2.evaluate(playerId,game);
  }
  node.setGameValue(game.getState().getValue(true).hashCode());
  SimulatedPlayer2 currentPlayer=(SimulatedPlayer2)game.getPlayer(game.getPlayerList().get());
  SimulationNode2 bestNode=null;
  List<Ability> allActions=currentPlayer.simulatePriority(game);
  optimize(game,allActions);
  if (logger.isInfoEnabled() && !allActions.isEmpty() && depth == maxDepth) {
    logger.info("String_Node_Str" + allActions.size() + "String_Node_Str"+ ' '+ allActions);
  }
  int counter=0;
  int bestValSubNodes=Integer.MIN_VALUE;
  for (  Ability action : allActions) {
    counter++;
    if (ALLOW_INTERRUPT && Thread.interrupted()) {
      Thread.currentThread().interrupt();
      logger.info("String_Node_Str" + depth + "String_Node_Str");
      break;
    }
    Game sim=game.copy();
    sim.setSimulation(true);
    if (sim.getPlayer(currentPlayer.getId()).activateAbility((ActivatedAbility)action.copy(),sim)) {
      sim.applyEffects();
      if (checkForRepeatedAction(sim,node,action,currentPlayer.getId())) {
        logger.debug("String_Node_Str" + depth + "String_Node_Str"+ action.toString());
        continue;
      }
      if (!sim.checkIfGameIsOver() && (action.isUsesStack() || action instanceof PassAbility)) {
        UUID nextPlayerId=sim.getPlayerList().get();
        do {
          sim.getPlayer(nextPlayerId).pass(game);
          nextPlayerId=sim.getPlayerList().getNext();
        }
 while (nextPlayerId != this.getId());
      }
      SimulationNode2 newNode=new SimulationNode2(node,sim,action,depth,currentPlayer.getId());
      sim.checkStateAndTriggered();
      int val;
      if (action instanceof PassAbility && sim.getStack().isEmpty()) {
        val=GameStateEvaluator2.evaluate(this.getId(),sim);
      }
 else {
        val=addActions(newNode,depth - 1,alpha,beta);
      }
      logger.debug("String_Node_Str" + BLANKS.substring(0,2 + (maxDepth - depth) * 3) + '['+ depth+ "String_Node_Str"+ counter+ "String_Node_Str"+ val+ "String_Node_Str"+ action.toString()+ "String_Node_Str");
      if (logger.isInfoEnabled() && depth >= maxDepth) {
        StringBuilder sb=new StringBuilder("String_Node_Str").append(depth).append("String_Node_Str").append(counter).append("String_Node_Str").append(val).append("String_Node_Str").append(action).append(action.isModal() ? "String_Node_Str" + action.getModes().getMode().toString() : "String_Node_Str").append(listTargets(game,action.getTargets())).append(')').append(logger.isTraceEnabled() ? "String_Node_Str" + newNode.hashCode() : "String_Node_Str");
        SimulationNode2 logNode=newNode;
        while (logNode.getChildren() != null && !logNode.getChildren().isEmpty()) {
          logNode=logNode.getChildren().get(0);
          if (logNode.getAbilities() != null && !logNode.getAbilities().isEmpty()) {
            sb.append("String_Node_Str").append(logNode.getDepth()).append(']').append(logNode.getAbilities().toString()).append('<').append(logNode.getScore()).append('>');
          }
        }
        logger.info(sb);
      }
      if (currentPlayer.getId().equals(playerId)) {
        if (val > bestValSubNodes) {
          bestValSubNodes=val;
        }
        if (depth == maxDepth && action instanceof PassAbility) {
          val=val - PASSIVITY_PENALTY;
        }
        if (val > alpha || (depth == maxDepth && val == alpha && RandomUtil.nextBoolean())) {
          alpha=val;
          bestNode=newNode;
          bestNode.setScore(val);
          if (!newNode.getChildren().isEmpty()) {
            bestNode.setCombat(newNode.getChildren().get(0).getCombat());
          }
          if (depth == maxDepth) {
            logger.info("String_Node_Str" + depth + "String_Node_Str"+ bestNode.getScore()+ "String_Node_Str"+ bestNode.getAbilities().toString());
            node.children.clear();
            node.children.add(bestNode);
            node.setScore(bestNode.getScore());
          }
        }
        if (val == GameStateEvaluator2.WIN_GAME_SCORE) {
          logger.debug("String_Node_Str");
          break;
        }
      }
 else {
        if (val < beta) {
          beta=val;
          bestNode=newNode;
          bestNode.setScore(val);
          if (!newNode.getChildren().isEmpty()) {
            bestNode.setCombat(newNode.getChildren().get(0).getCombat());
          }
        }
        if (val == GameStateEvaluator2.LOSE_GAME_SCORE) {
          logger.debug("String_Node_Str");
          break;
        }
      }
      if (alpha >= beta) {
        break;
      }
      if (SimulationNode2.nodeCount > maxNodes) {
        logger.debug("String_Node_Str");
        break;
      }
    }
  }
  if (depth == maxDepth) {
    logger.info("String_Node_Str" + depth + "String_Node_Str"+ SimulationNode2.nodeCount);
  }
  if (bestNode != null) {
    node.children.clear();
    node.children.add(bestNode);
    node.setScore(bestNode.getScore());
    if (logger.isTraceEnabled() && !bestNode.getAbilities().toString().equals("String_Node_Str")) {
      logger.trace(new StringBuilder("String_Node_Str").append(depth).append("String_Node_Str").append(depth).append("String_Node_Str").append(bestNode.getScore()).append("String_Node_Str").append(bestNode.getAbilities().toString()).toString());
    }
  }
  if (currentPlayer.getId().equals(playerId)) {
    return bestValSubNodes;
  }
 else {
    return beta;
  }
}

Fixed version (ground truth):
protected int simulatePriority(SimulationNode2 node,Game game,int depth,int alpha,int beta){
  if (ALLOW_INTERRUPT && Thread.interrupted()) {
    Thread.currentThread().interrupt();
    logger.info("String_Node_Str");
    return GameStateEvaluator2.evaluate(playerId,game);
  }
  node.setGameValue(game.getState().getValue(true).hashCode());
  SimulatedPlayer2 currentPlayer=(SimulatedPlayer2)game.getPlayer(game.getPlayerList().get());
  SimulationNode2 bestNode=null;
  List<Ability> allActions=currentPlayer.simulatePriority(game);
  optimize(game,allActions);
  if (logger.isInfoEnabled() && !allActions.isEmpty() && depth == maxDepth) {
    logger.info("String_Node_Str" + allActions.size() + "String_Node_Str"+ ' '+ allActions);
  }
  int counter=0;
  int bestValSubNodes=Integer.MIN_VALUE;
  for (  Ability action : allActions) {
    counter++;
    if (ALLOW_INTERRUPT && Thread.interrupted()) {
      Thread.currentThread().interrupt();
      logger.info("String_Node_Str" + depth + "String_Node_Str");
      break;
    }
    Game sim=game.copy();
    sim.setSimulation(true);
    if (sim.getPlayer(currentPlayer.getId()).activateAbility((ActivatedAbility)action.copy(),sim)) {
      sim.applyEffects();
      if (checkForRepeatedAction(sim,node,action,currentPlayer.getId())) {
        logger.debug("String_Node_Str" + depth + "String_Node_Str"+ action.toString());
        continue;
      }
      if (!sim.checkIfGameIsOver() && (action.isUsesStack() || action instanceof PassAbility)) {
        UUID nextPlayerId=sim.getPlayerList().get();
        do {
          sim.getPlayer(nextPlayerId).pass(game);
          nextPlayerId=sim.getPlayerList().getNext();
        }
 while (!Objects.equals(nextPlayerId,this.getId()));
      }
      SimulationNode2 newNode=new SimulationNode2(node,sim,action,depth,currentPlayer.getId());
      sim.checkStateAndTriggered();
      int val;
      if (action instanceof PassAbility && sim.getStack().isEmpty()) {
        val=GameStateEvaluator2.evaluate(this.getId(),sim);
      }
 else {
        val=addActions(newNode,depth - 1,alpha,beta);
      }
      logger.debug("String_Node_Str" + BLANKS.substring(0,2 + (maxDepth - depth) * 3) + '['+ depth+ "String_Node_Str"+ counter+ "String_Node_Str"+ val+ "String_Node_Str"+ action.toString()+ "String_Node_Str");
      if (logger.isInfoEnabled() && depth >= maxDepth) {
        StringBuilder sb=new StringBuilder("String_Node_Str").append(depth).append("String_Node_Str").append(counter).append("String_Node_Str").append(val).append("String_Node_Str").append(action).append(action.isModal() ? "String_Node_Str" + action.getModes().getMode().toString() : "String_Node_Str").append(listTargets(game,action.getTargets())).append(')').append(logger.isTraceEnabled() ? "String_Node_Str" + newNode.hashCode() : "String_Node_Str");
        SimulationNode2 logNode=newNode;
        while (logNode.getChildren() != null && !logNode.getChildren().isEmpty()) {
          logNode=logNode.getChildren().get(0);
          if (logNode.getAbilities() != null && !logNode.getAbilities().isEmpty()) {
            sb.append("String_Node_Str").append(logNode.getDepth()).append(']').append(logNode.getAbilities().toString()).append('<').append(logNode.getScore()).append('>');
          }
        }
        logger.info(sb);
      }
      if (currentPlayer.getId().equals(playerId)) {
        if (val > bestValSubNodes) {
          bestValSubNodes=val;
        }
        if (depth == maxDepth && action instanceof PassAbility) {
          val=val - PASSIVITY_PENALTY;
        }
        if (val > alpha || (depth == maxDepth && val == alpha && RandomUtil.nextBoolean())) {
          alpha=val;
          bestNode=newNode;
          bestNode.setScore(val);
          if (!newNode.getChildren().isEmpty()) {
            bestNode.setCombat(newNode.getChildren().get(0).getCombat());
          }
          if (depth == maxDepth) {
            logger.info("String_Node_Str" + depth + "String_Node_Str"+ bestNode.getScore()+ "String_Node_Str"+ bestNode.getAbilities().toString());
            node.children.clear();
            node.children.add(bestNode);
            node.setScore(bestNode.getScore());
          }
        }
        if (val == GameStateEvaluator2.WIN_GAME_SCORE) {
          logger.debug("String_Node_Str");
          break;
        }
      }
 else {
        if (val < beta) {
          beta=val;
          bestNode=newNode;
          bestNode.setScore(val);
          if (!newNode.getChildren().isEmpty()) {
            bestNode.setCombat(newNode.getChildren().get(0).getCombat());
          }
        }
        if (val == GameStateEvaluator2.LOSE_GAME_SCORE) {
          logger.debug("String_Node_Str");
          break;
        }
      }
      if (alpha >= beta) {
        break;
      }
      if (SimulationNode2.nodeCount > maxNodes) {
        logger.debug("String_Node_Str");
        break;
      }
    }
  }
  if (depth == maxDepth) {
    logger.info("String_Node_Str" + depth + "String_Node_Str"+ SimulationNode2.nodeCount);
  }
  if (bestNode != null) {
    node.children.clear();
    node.children.add(bestNode);
    node.setScore(bestNode.getScore());
    if (logger.isTraceEnabled() && !bestNode.getAbilities().toString().equals("String_Node_Str")) {
      logger.trace(new StringBuilder("String_Node_Str").append(depth).append("String_Node_Str").append(depth).append("String_Node_Str").append(bestNode.getScore()).append("String_Node_Str").append(bestNode.getAbilities().toString()).toString());
    }
  }
  if (currentPlayer.getId().equals(playerId)) {
    return bestValSubNodes;
  }
 else {
    return beta;
  }
}