nus-yam/ex-repair huggingface dataset:
Program: 86828
Project: 86828
Buggy source:
/** 
 * @param entity
 * @param x
 * @param y
 * @param width
 * @param height
 * @return a random position anywhere in the supplied bounds
 */
public Vector2f getRandomSpot(Entity entity,int x,int y,int width,int height){
  Vector2f pos=new Vector2f(x + random.nextInt(width),y + random.nextInt(height));
  Rectangle temp=new Rectangle(entity.getBounds());
  temp.setLocation(pos);
  int loopChecker=0;
  while (map.rectCollides(temp)) {
    pos.x=x + random.nextInt(width);
    pos.y=y + random.nextInt(height);
    temp.setLocation(pos);
    if (loopChecker++ > 1000) {
      return null;
    }
  }
  return pos;
}

Fixed version (ground truth):
/** 
 * @param entity
 * @param x
 * @param y
 * @param width
 * @param height
 * @return a random position anywhere in the supplied bounds
 */
public Vector2f getRandomSpot(Entity entity,int x,int y,int width,int height){
  Vector2f pos=new Vector2f(x + random.nextInt(width),y + random.nextInt(height));
  Rectangle temp=new Rectangle(entity.getBounds());
  temp.setLocation(pos);
  int loopChecker=0;
  while (map.rectCollides(temp) && !map.hasWorldCollidableTile(temp.x,temp.y)) {
    pos.x=x + random.nextInt(width);
    pos.y=y + random.nextInt(height);
    temp.setLocation(pos);
    if (loopChecker++ > 100000) {
      return null;
    }
  }
  return pos;
}
Program: 86830
Project: 86830
Buggy source:
/** 
 * Lets the brain think for a game tick
 * @param timeStep
 */
public void update(TimeStep timeStep){
  if (player.isAlive()) {
    this.memory.update(timeStep);
    this.sensors.update(timeStep);
    this.motion.update(timeStep);
    this.thoughtProcess.think(timeStep,this);
    this.targetingSystem.update(timeStep);
    debugDraw();
    debugDrawPathPlanner();
  }
}

Fixed version (ground truth):
/** 
 * Lets the brain think for a game tick
 * @param timeStep
 */
public void update(TimeStep timeStep){
  if (player.isAlive()) {
    this.memory.update(timeStep);
    this.sensors.update(timeStep);
    this.motion.update(timeStep);
    this.thoughtProcess.think(timeStep,this);
    this.targetingSystem.update(timeStep);
    debugDraw();
  }
}
Program: 86831
Project: 86831
Buggy source:
@SuppressWarnings("String_Node_Str") private void debugDraw(){
  Cover cover=world.getCover(entityOwner,entityOwner.getPos());
  DebugDraw.fillRectRelative((int)cover.getCoverPos().x,(int)cover.getCoverPos().y,5,5,0xff00ff00);
  List<AttackDirection> attackDirections=world.getAttackDirections(entityOwner);
  for (  AttackDirection dir : attackDirections) {
    DebugDraw.drawLineRelative(entityOwner.getPos(),dir.getDirection(),0xff00ff00);
  }
  DebugDraw.drawString(this.thoughtProcess.toString(),new Vector2f(20,700),0xff00ffff);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void debugDraw(){
  Cover cover=world.getCover(entityOwner,entityOwner.getPos());
  DebugDraw.fillRectRelative((int)cover.getCoverPos().x,(int)cover.getCoverPos().y,5,5,0xff00ff00);
  List<AttackDirection> attackDirections=world.getAttackDirections(entityOwner);
  for (  AttackDirection dir : attackDirections) {
    DebugDraw.drawLineRelative(entityOwner.getPos(),dir.getDirection(),0xff00ff00);
  }
  Vector2f p=new Vector2f(entityOwner.getPos().x - 50,entityOwner.getPos().y + 40);
  String str=this.thoughtProcess.toString();
  String[] sections=str.split("String_Node_Str");
  for (  String section : sections) {
    String[] attributes=section.split("String_Node_Str");
    for (    String att : attributes) {
      DebugDraw.drawStringRelative(att,p,0xff00ffff);
      p.y+=12;
    }
    p.x+=10;
  }
}
Program: 86832
Project: 86832
Buggy source:
@Override public void receiveAICommand(PlayerInfo forBot,AICommand command){
  if (forBot.isBot() && forBot.isAlive()) {
    Brain brain=getBrain(forBot);
    if (brain != null) {
      Action action=this.aiCommands.compile(brain,command);
      if (action != null) {
        brain.getCommunicator().post(action);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void receiveAICommand(PlayerInfo forBot,AICommand command){
  if (forBot.isBot() && forBot.isAlive()) {
    Brain brain=getBrain(forBot);
    if (brain != null) {
      Action action=this.aiCommands.compile(brain,command);
      if (action != null) {
        brain.getCommunicator().makeTopPriority(action);
      }
    }
  }
}
Program: 86833
Project: 86833
Buggy source:
/** 
 */
public ReactiveThinkListener(TeamStrategy strategy,Goals goals){
  this.strategy=strategy;
  this.goals=goals;
  this.longTermGoal=new Goal();
  this.reactiveGoal=new Goal();
}

Fixed version (ground truth):
/** 
 */
public ReactiveThinkListener(TeamStrategy strategy,Goals goals){
  this.strategy=strategy;
  this.goals=goals;
  this.longTermGoal=new Goal("String_Node_Str");
  this.reactiveGoal=new Goal("String_Node_Str");
}
Program: 86834
Project: 86834
Buggy source:
/** 
 */
public WeightedThoughtProcess(TeamStrategy teamStrategy,Brain brain){
  Goals goals=brain.getWorld().getGoals();
  this.currentGoal=new ConcurrentGoal(new WeightedGoal(brain,new AttackActionEvaluator(goals,brain.getRandomRangeMin(0.85),0.82),new CommandActionEvaluator(goals,brain.getRandomRangeMin(0.8),0.8),new InvestigateActionEvaluator(goals,brain.getRandomRange(0.5,0.9),0.6),new ExploreActionEvaluator(goals,brain.getRandomRange(0.1,0.5),0.5)),new WeightedGoal(brain,new ReloadWeaponEvaluator(goals,brain.getRandomRange(0.3,0.8),0),new SwitchWeaponEvaluator(goals,brain.getRandomRange(0.3,0.8),0),new DoNothingEvaluator(goals,brain.getRandomRange(0.4,0.9),0)));
}

Fixed version (ground truth):
/** 
 */
public WeightedThoughtProcess(TeamStrategy teamStrategy,Brain brain){
  Goals goals=brain.getWorld().getGoals();
  this.currentGoal=new ConcurrentGoal(new WeightedGoal(brain,"String_Node_Str",new AttackActionEvaluator(goals,brain.getRandomRangeMin(0.85),0.82),new DefendSelfActionEvaluator(goals,brain.getRandomRangeMin(0.85),0.81),new CommandActionEvaluator(goals,brain.getRandomRange(0.7,0.8),0.8),new InvestigateActionEvaluator(goals,brain.getRandomRange(0.5,0.9),0.6),new ExploreActionEvaluator(goals,brain.getRandomRange(0.1,0.5),0.5)),new WeightedGoal(brain,"String_Node_Str",new ReloadWeaponEvaluator(goals,brain.getRandomRange(0.3,0.8),0),new SwitchWeaponEvaluator(goals,brain.getRandomRange(0.3,0.8),0),new DoNothingEvaluator(goals,brain.getRandomRange(0.4,0.9),0)));
}
Program: 86835
Project: 86835
Buggy source:
@Override public DebugInformation getDebugInformation(){
  DebugInformation info=new DebugInformation();
  info.add("String_Node_Str",this.currentGoal);
  return info;
}

Fixed version (ground truth):
@Override public DebugInformation getDebugInformation(){
  DebugInformation info=new DebugInformation();
  info.add("String_Node_Str",this.currentGoal.getAction(0));
  return info;
}
Program: 86836
Project: 86836
Buggy source:
@Override public boolean isFinished(Brain brain){
  boolean isfinished=!this.followMe.isAlive() || this.lastVisibleTime > timeSinceLastSeenExpireMSec;
  if (isfinished) {
    System.out.println("String_Node_Str");
  }
  return isfinished;
}

Fixed version (ground truth):
@Override public boolean isFinished(Brain brain){
  boolean isfinished=!this.followMe.isAlive() || this.lastVisibleTime > timeSinceLastSeenExpireMSec;
  return isfinished;
}
Program: 86837
Project: 86837
Buggy source:
@Override public void start(Brain brain){
  this.timeToDefend=this.originalTimeToDefend;
  if (!this.interrupted) {
    this.currentDirection=(currentDirection + 1) % this.attackDirs.size();
    this.dir.set(this.attackDirs.get(currentDirection).getDirection());
  }
}

Fixed version (ground truth):
@Override public void start(Brain brain){
  this.timeToDefend=this.originalTimeToDefend;
  if (!this.interrupted && this.attackDirs.size() > 0) {
    this.currentDirection=(currentDirection + 1) % this.attackDirs.size();
    this.dir.set(this.attackDirs.get(currentDirection).getDirection());
  }
}
Program: 86838
Project: 86838
Buggy source:
@Override public DebugInformation getDebugInformation(){
  DebugInformation me=new DebugInformation();
  me.add("String_Node_Str",this.actions);
  return me;
}

Fixed version (ground truth):
@Override public DebugInformation getDebugInformation(){
  DebugInformation me=new DebugInformation();
  me.add("String_Node_Str",this.name);
  me.add("String_Node_Str",this.actions.peek());
  return me;
}
Program: 86839
Project: 86839
Buggy source:
/** 
 */
public Goal(){
  this.actions=new ConcurrentLinkedDeque<>();
  this.isFirstAction=true;
}

Fixed version (ground truth):
/** 
 */
public Goal(String name){
  this.actions=new ConcurrentLinkedDeque<>();
  this.isFirstAction=true;
  this.name=name;
}
Program: 86840
Project: 86840
Buggy source:
public Goal enemyEncountered(Goals goals,Brain brain){
  return new WeightedGoal(brain,new MoveTowardEnemyEvaluator(goals,brain.getRandomRangeMin(0.48),0.8),new TakeCoverEvaluator(goals,brain.getRandomRangeMin(0.3),0.9));
}

Fixed version (ground truth):
public Goal enemyEncountered(Goals goals,Brain brain){
  return new WeightedGoal(brain,"String_Node_Str",new MoveTowardEnemyEvaluator(goals,brain.getRandomRangeMin(0.48),0.8),new TakeCoverEvaluator(goals,brain.getRandomRangeMin(0.3),0.9));
}
Program: 86841
Project: 86841
Buggy source:
public Action surpressFire(Goals goals,Brain brain,Vector2f position){
  return new WeightedGoal(brain,new SurpressFireEvaluator(goals,brain.getRandomRangeMin(0.3),0.9,position));
}

Fixed version (ground truth):
public Action surpressFire(Goals goals,Brain brain,Vector2f position){
  return new WeightedGoal(brain,"String_Node_Str",new SurpressFireEvaluator(goals,brain.getRandomRangeMin(0.3),0.9,position));
}
Program: 86842
Project: 86842
Buggy source:
/** 
 * Goal which decides which attack method to use
 * @param goals
 * @param brain
 * @return the goal
 */
public Goal decideAttackMethod(Goals goals,Brain brain){
  return new WeightedGoal(brain,new ShootWeaponEvaluator(goals,brain.getRandomRangeMin(0.8),0.8),new MeleeEvaluator(goals,brain.getRandomRangeMin(0.5),0),new GrenadeEvaluator(goals,brain.getRandomRangeMin(0.2),0.2));
}

Fixed version (ground truth):
/** 
 * Goal which decides which attack method to use
 * @param goals
 * @param brain
 * @return the goal
 */
public Goal decideAttackMethod(Goals goals,Brain brain){
  return new WeightedGoal(brain,"String_Node_Str",new ShootWeaponEvaluator(goals,brain.getRandomRangeMin(0.8),0.8),new MeleeEvaluator(goals,brain.getRandomRangeMin(0.5),0),new GrenadeEvaluator(goals,brain.getRandomRangeMin(0.2),0.2));
}
Program: 86843
Project: 86843
Buggy source:
public Action moveToCover(Cover cover,Brain brain){
  Action action=getScriptedAction("String_Node_Str");
  action.getActionResult().setValue(cover);
  return new ConcurrentGoal(action,new WeightedGoal(brain,new ShootWeaponEvaluator(this,brain.getRandomRangeMin(0.8),0.8),new MeleeEvaluator(this,brain.getRandomRange(0.2,0.4),0),new DoNothingEvaluator(this,brain.getRandomRangeMin(0.6),0),new GrenadeEvaluator(this,brain.getRandomRangeMin(0.5),0)));
}

Fixed version (ground truth):
public Action moveToCover(Cover cover,Brain brain){
  Action action=getScriptedAction("String_Node_Str");
  action.getActionResult().setValue(cover);
  return new ConcurrentGoal(action,new WeightedGoal(brain,"String_Node_Str",new ShootWeaponEvaluator(this,brain.getRandomRangeMin(0.8),0.8),new MeleeEvaluator(this,brain.getRandomRange(0.2,0.4),0),new DoNothingEvaluator(this,brain.getRandomRangeMin(0.6),0),new GrenadeEvaluator(this,brain.getRandomRangeMin(0.5),0)));
}
Program: 86844
Project: 86844
Buggy source:
/** 
 */
public PlantBombAction(BombTarget bomb){
  this.bomb=bomb;
}

Fixed version (ground truth):
/** 
 * @param target 
 */
public PlantBombAction(BombTarget target){
  this.target=target;
}
Program: 86845
Project: 86845
Buggy source:
@Override public void start(Brain brain){
}

Fixed version (ground truth):
@Override public void start(Brain brain){
  if (target != null && target.bombActive()) {
    getActionResult().setSuccess();
  }
 else {
    getActionResult().setFailure();
  }
}
Program: 86846
Project: 86846
Buggy source:
@Override public void update(Brain brain,TimeStep timeStep){
  if (bomb.bombActive()) {
    getActionResult().setSuccess();
  }
 else {
    Locomotion motion=brain.getMotion();
    if (!bomb.bombPlanting() || !motion.isPlanting()) {
      motion.plantBomb(bomb);
    }
    getActionResult().setFailure();
  }
}

Fixed version (ground truth):
@Override public void update(Brain brain,TimeStep timeStep){
  if (target != null) {
    if (target.bombActive()) {
      getActionResult().setSuccess();
    }
 else {
      Locomotion motion=brain.getMotion();
      if (!target.bombPlanting() || !motion.isPlanting()) {
        motion.plantBomb(target);
      }
      getActionResult().setFailure();
    }
  }
}
Program: 86847
Project: 86847
Buggy source:
@Override public DebugInformation getDebugInformation(){
  return super.getDebugInformation().add("String_Node_Str",this.bomb.getId());
}

Fixed version (ground truth):
@Override public DebugInformation getDebugInformation(){
  return super.getDebugInformation().add("String_Node_Str",this.target.getId());
}
Program: 86848
Project: 86848
Buggy source:
@Override public boolean isFinished(Brain brain){
  if (!bomb.isAlive()) {
    return true;
  }
  if (bomb.bombActive()) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isFinished(Brain brain){
  if (target == null || !target.isAlive()) {
    return true;
  }
  if (target.bombActive()) {
    return true;
  }
  if (!brain.getEntityOwner().isTouching(target)) {
    return true;
  }
  return false;
}
Program: 86849
Project: 86849
Buggy source:
@SuppressWarnings("String_Node_Str") private void debugDrawPathPlanner(){
  PathFeeder<?> pathPlanner=motion.getPathFeeder();
  if (pathPlanner != null) {
    for (    GraphNode<Tile,?> node : pathPlanner.getPath()) {
      Tile tile=node.getValue();
      if (tile != null) {
        DebugDraw.drawRectRelative(tile.getX(),tile.getY(),tile.getWidth(),tile.getHeight(),0xff00ff00);
      }
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void debugDrawPathPlanner(){
  PathPlanner<?> pathPlanner=motion.getPathPlanner();
  if (pathPlanner != null) {
    for (    GraphNode<Tile,?> node : pathPlanner.getPath()) {
      Tile tile=node.getValue();
      if (tile != null) {
        DebugDraw.drawRectRelative(tile.getX(),tile.getY(),tile.getWidth(),tile.getHeight(),0xff00ff00);
      }
    }
  }
}
Program: 86850
Project: 86850
Buggy source:
/** 
 * Do the actual movement
 */
private void moveEntity(){
  moveDelta.zeroOut();
  if (pathFeeder.hasPath()) {
    if (!pathFeeder.atDestination()) {
      Vector2f nextDest=pathFeeder.nextDestination(me);
      moveDelta.set(nextDest);
    }
 else {
      Vector2f nextDest=pathFeeder.getDestination();
      Vector2f.Vector2fSubtract(nextDest,me.getPos(),moveDelta);
      if (moveDelta.lengthSquared() < 26) {
        moveDelta.zeroOut();
      }
    }
  }
  directMove(moveDelta);
}

Fixed version (ground truth):
/** 
 * Do the actual movement
 */
private void moveEntity(){
  moveDelta.zeroOut();
  if (pathPlanner.hasPath()) {
    if (!pathPlanner.atDestination()) {
      Vector2f nextDest=pathPlanner.nextDestination(me);
      moveDelta.set(nextDest);
    }
 else {
      Vector2f nextDest=pathPlanner.getDestination();
      Vector2f.Vector2fSubtract(nextDest,me.getPos(),moveDelta);
      if (moveDelta.lengthSquared() < 26) {
        moveDelta.zeroOut();
      }
    }
  }
  directMove(moveDelta);
}
Program: 86851
Project: 86851
Buggy source:
@SuppressWarnings("String_Node_Str") private void debugDraw(){
  int y=100;
  int x=20;
  final int yOffset=20;
  int color=0xff00ff00;
  final String message="String_Node_Str";
  DebugDraw.drawString(String.format(message,"String_Node_Str","String_Node_Str","String_Node_Str"),x,y,color);
  DebugDraw.drawString("String_Node_Str",x,y+=yOffset,color);
  String text=String.format(message,"String_Node_Str",destinationGoal.getAction() != null ? destinationGoal.getAction().getClass().getSimpleName() : "String_Node_Str",destinationGoal.isFinished(brain));
  DebugDraw.drawString(text,x,y+=yOffset,color);
  text=String.format(message,"String_Node_Str",facingGoal.getAction() != null ? facingGoal.getAction().getClass().getSimpleName() : "String_Node_Str",facingGoal.isFinished(brain));
  DebugDraw.drawString(text,x,y+=yOffset,color);
  text=String.format(message,"String_Node_Str",handsGoal.getAction() != null ? handsGoal.getAction().getClass().getSimpleName() : "String_Node_Str",handsGoal.isFinished(brain));
  DebugDraw.drawString(text,x,y+=yOffset,color);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void debugDraw(){
  MapGraph<?> graph=brain.getWorld().getGraph();
  for (int y=0; y < graph.graph.length; y++) {
    for (int x=0; x < graph.graph[0].length; x++) {
      GraphNode<Tile,?> node=graph.getNodeByIndex(x,y);
      if (node != null) {
        Tile t=node.getValue();
      }
    }
  }
  Entity ent=brain.getEntityOwner();
  if (ent != null) {
    DebugDraw.fillRectRelative(ent.getBounds().x,ent.getBounds().y,ent.getBounds().width,ent.getBounds().height,0xffff0000);
  }
}
Program: 86852
Project: 86852
Buggy source:
/** 
 * @return the destination this entity is moving towards, or null if nodestination
 */
public Vector2f getDestination(){
  if (this.pathFeeder != null) {
    return pathFeeder.getDestination();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @return the destination this entity is moving towards, or null if nodestination
 */
public Vector2f getDestination(){
  if (this.pathPlanner != null) {
    return pathPlanner.getDestination();
  }
  return null;
}
Program: 86853
Project: 86853
Buggy source:
/** 
 * Remove the   {@link PathFeeder}
 */
public void emptyPath(){
  this.pathFeeder.clearPath();
}

Fixed version (ground truth):
/** 
 * Remove the   {@link PathPlanner}
 */
public void emptyPath(){
  this.pathPlanner.clearPath();
}
Program: 86854
Project: 86854
Buggy source:
/** 
 */
public Locomotion(Brain brain){
  this.brain=brain;
  this.pathFeeder=new PathFeeder<>(brain.getWorld().getGraph());
  this.random=brain.getWorld().getRandom();
  this.destinationGoal=new DecoratorAction(brain);
  this.legsGoal=new DecoratorAction(brain);
  this.facingGoal=new DecoratorAction(brain);
  this.handsGoal=new DecoratorAction(brain);
  this.moveDelta=new Vector2f();
  this.headScan=new HeadScanAction();
  this.moveAction=new MoveAction();
  this.lookAt=new LookAtAction(0);
  this.stareAt=new StareAtEntityAction(null);
  this.fireAt=new FireAtAction(null);
  this.crouchAction=new CrouchAction();
  this.walkAction=new WalkAction();
  this.sprintAction=new SprintAction();
  this.reloadAction=new ReloadAction();
  this.meleeAction=new MeleeAction();
  this.dropWeaponAction=new DropWeaponAction();
  this.shootAction=new ShootAction();
  reset(brain);
}

Fixed version (ground truth):
/** 
 */
public Locomotion(Brain brain){
  this.brain=brain;
  this.pathPlanner=new PathPlanner<>(brain.getWorld().getGraph());
  this.random=brain.getWorld().getRandom();
  this.destinationGoal=new DecoratorAction(brain);
  this.legsGoal=new DecoratorAction(brain);
  this.facingGoal=new DecoratorAction(brain);
  this.handsGoal=new DecoratorAction(brain);
  this.moveDelta=new Vector2f();
  this.headScan=new HeadScanAction();
  this.moveAction=new MoveAction();
  this.lookAt=new LookAtAction(0);
  this.stareAt=new StareAtEntityAction(null);
  this.fireAt=new FireAtAction(null);
  this.crouchAction=new CrouchAction();
  this.walkAction=new WalkAction();
  this.sprintAction=new SprintAction();
  this.reloadAction=new ReloadAction();
  this.meleeAction=new MeleeAction();
  this.dropWeaponAction=new DropWeaponAction();
  this.shootAction=new ShootAction();
  reset(brain);
}
Program: 86855
Project: 86855
Buggy source:
@Override public void update(Brain brain,TimeStep timeStep){
  PlayerEntity ent=brain.getEntityOwner();
  this.sampleTime-=timeStep.getDeltaTime();
  if (this.sampleTime < 0) {
    PathFeeder<?> feeder=brain.getMotion().getPathFeeder();
    Vector2f dest=null;
    if (feeder.hasPath()) {
      dest=feeder.nextDestination(ent);
    }
 else {
      dest=ent.getMovementDir();
    }
    Vector2f.Vector2fNormalize(dest,dest);
    destination.set(dest);
    this.sampleTime=200;
  }
  float currentOrientation=ent.getOrientation();
  float destinationOrientation=(float)(Math.atan2(destination.y,destination.x));
  float deltaOrientation=(destinationOrientation - currentOrientation);
  float deltaOrientationAbs=Math.abs(deltaOrientation);
  if (deltaOrientationAbs > Math.PI) {
    deltaOrientation=deltaOrientationAbs - fullCircle;
  }
  final double movementSpeed=Math.toRadians(15.0f);
  if (deltaOrientation != 0) {
    float direction=deltaOrientation / deltaOrientationAbs;
    currentOrientation+=(direction * Math.min(movementSpeed,deltaOrientationAbs));
    currentOrientation%=fullCircle;
  }
  ent.setOrientation(currentOrientation);
}

Fixed version (ground truth):
@Override public void update(Brain brain,TimeStep timeStep){
  PlayerEntity ent=brain.getEntityOwner();
  this.sampleTime-=timeStep.getDeltaTime();
  if (this.sampleTime < 0) {
    PathPlanner<?> feeder=brain.getMotion().getPathPlanner();
    Vector2f dest=null;
    if (feeder.hasPath()) {
      dest=feeder.nextDestination(ent);
    }
 else {
      dest=ent.getMovementDir();
    }
    Vector2f.Vector2fNormalize(dest,dest);
    destination.set(dest);
    this.sampleTime=200;
  }
  float currentOrientation=ent.getOrientation();
  float destinationOrientation=(float)(Math.atan2(destination.y,destination.x));
  float deltaOrientation=(destinationOrientation - currentOrientation);
  float deltaOrientationAbs=Math.abs(deltaOrientation);
  if (deltaOrientationAbs > Math.PI) {
    deltaOrientation=deltaOrientationAbs - fullCircle;
  }
  final double movementSpeed=Math.toRadians(15.0f);
  if (deltaOrientation != 0) {
    float direction=deltaOrientation / deltaOrientationAbs;
    currentOrientation+=(direction * Math.min(movementSpeed,deltaOrientationAbs));
    currentOrientation%=fullCircle;
  }
  ent.setOrientation(currentOrientation);
}
Program: 86856
Project: 86856
Buggy source:
@Override public void start(Brain brain){
  Vector2f position=brain.getEntityOwner().getPos();
  PathFeeder<?> feeder=brain.getMotion().getPathFeeder();
  if (this.zonesToAvoid.isEmpty()) {
    feeder.findFuzzyPath(position,this.destination,this.fuzzyNess);
  }
 else {
    feeder.findAvoidancePath(position,this.destination,this.zonesToAvoid);
  }
}

Fixed version (ground truth):
@Override public void start(Brain brain){
  Vector2f position=brain.getEntityOwner().getCenterPos();
  PathPlanner<?> feeder=brain.getMotion().getPathPlanner();
  if (this.zonesToAvoid.isEmpty()) {
    feeder.findFuzzyPath(position,this.destination,this.fuzzyNess);
  }
 else {
    feeder.findAvoidancePath(position,this.destination,this.zonesToAvoid);
  }
}
Program: 86857
Project: 86857
Buggy source:
@Override public boolean isFinished(Brain brain){
  PathFeeder<?> path=brain.getMotion().getPathFeeder();
  return !path.hasPath() || path.atDestination();
}

Fixed version (ground truth):
@Override public boolean isFinished(Brain brain){
  PathPlanner<?> path=brain.getMotion().getPathPlanner();
  return !path.hasPath() || path.atDestination();
}
Program: 86858
Project: 86858
Buggy source:
@Override public boolean isFinished(Brain brain){
  PathFeeder<?> path=brain.getMotion().getPathFeeder();
  return path.atDestination();
}

Fixed version (ground truth):
@Override public boolean isFinished(Brain brain){
  PathPlanner<?> path=brain.getMotion().getPathPlanner();
  return path.atDestination();
}
Program: 86859
Project: 86859
Buggy source:
/** 
 * Renders the game
 * @param canvas
 */
public void render(Canvas canvas){
  renderFrameBuffer(canvas);
  canvas.begin();
  map.render(canvas,camera,0);
  canvas.end();
  backgroundEffects.render(canvas,camera,0);
  ClientEntity[] entityList=entities.getEntities();
  int size=entityList.length;
  for (int i=0; i < size; i++) {
    renderingOrderEntities[i]=null;
    ClientEntity entity=entityList[i];
    if (entity != null) {
      if (entity.isBackgroundObject()) {
        entity.render(canvas,camera,0);
      }
 else {
        renderingOrderEntities[i]=entity;
      }
    }
  }
  for (int i=0; i < size; i++) {
    ClientEntity entity=renderingOrderEntities[i];
    if (entity != null) {
      entity.render(canvas,camera,0);
    }
    renderingOrderEntities[i]=null;
  }
  foregroundEffects.render(canvas,camera,0);
  map.renderForeground(canvas,camera,0);
  canvas.setColor(0,45);
  map.renderSolid(canvas,camera,0);
  lightSystem.render(canvas,camera,0);
  DebugDraw.enable(false);
  DebugDraw.render(canvas,camera);
  canvas.setShader(null);
  hud.render(canvas,camera,0);
}

Fixed version (ground truth):
/** 
 * Renders the game
 * @param canvas
 */
public void render(Canvas canvas){
  renderFrameBuffer(canvas);
  canvas.begin();
  map.render(canvas,camera,0);
  canvas.end();
  backgroundEffects.render(canvas,camera,0);
  ClientEntity[] entityList=entities.getEntities();
  int size=entityList.length;
  for (int i=0; i < size; i++) {
    renderingOrderEntities[i]=null;
    ClientEntity entity=entityList[i];
    if (entity != null) {
      if (entity.isBackgroundObject()) {
        entity.render(canvas,camera,0);
      }
 else {
        renderingOrderEntities[i]=entity;
      }
    }
  }
  for (int i=0; i < size; i++) {
    ClientEntity entity=renderingOrderEntities[i];
    if (entity != null) {
      entity.render(canvas,camera,0);
    }
    renderingOrderEntities[i]=null;
  }
  foregroundEffects.render(canvas,camera,0);
  map.renderForeground(canvas,camera,0);
  canvas.setColor(0,45);
  map.renderSolid(canvas,camera,0);
  lightSystem.render(canvas,camera,0);
  DebugDraw.enable(true);
  DebugDraw.render(canvas,camera);
  canvas.setShader(null);
  hud.render(canvas,camera,0);
}
Program: 86860
Project: 86860
Buggy source:
/** 
 * @param runtime
 * @param world
 */
public Brain(TeamStrategy strategy,World world,PlayerInfo player){
  this.world=world;
  this.player=player;
  this.entityOwner=player.getEntity();
  this.memory=new Memory();
  this.motion=new Locomotion(this);
  this.sensors=new Sensors(this);
  this.thoughtProcess=new SimpleThoughtProcess(new ReactiveThinkListener(strategy,world.getGoals()),this);
  this.communicator=new Communicator();
}

Fixed version (ground truth):
/** 
 * @param runtime
 * @param world
 */
public Brain(TeamStrategy strategy,World world,PlayerInfo player){
  this.world=world;
  this.player=player;
  this.entityOwner=player.getEntity();
  this.memory=new Memory();
  this.motion=new Locomotion(this);
  this.sensors=new Sensors(this);
  this.thoughtProcess=new SimpleThoughtProcess(new ReactiveThinkListener(strategy,world.getGoals()),this);
  this.communicator=new Communicator(world);
}
Program: 86861
Project: 86861
Buggy source:
/** 
 * Lets the brain think for a game tick
 * @param timeStep
 */
public void update(TimeStep timeStep){
  if (player.isAlive()) {
    this.sensors.update(timeStep);
    this.motion.update(timeStep);
    this.thoughtProcess.think(timeStep,this);
    debugDrawPathPlanner();
  }
}

Fixed version (ground truth):
/** 
 * Lets the brain think for a game tick
 * @param timeStep
 */
public void update(TimeStep timeStep){
  if (player.isAlive()) {
    this.sensors.update(timeStep);
    this.motion.update(timeStep);
    this.thoughtProcess.think(timeStep,this);
  }
}
Program: 86862
Project: 86862
Buggy source:
/** 
 */
public Communicator(){
  this.commands=new ConcurrentLinkedQueue<Action>();
}

Fixed version (ground truth):
/** 
 * @param world
 */
public Communicator(World world){
  this.world=world;
  this.commands=new ConcurrentLinkedQueue<Action>();
  this.broadcastBounds=new Rectangle(1000,1000);
}
Program: 86863
Project: 86863
Buggy source:
@Override public void update(TimeStep timeStep){
  for (int i=0; i < brains.length; i++) {
    Brain brain=brains[i];
    if (brain != null) {
      brain.update(timeStep);
    }
  }
  this.alliedAIStrategy.update(timeStep,game);
  this.axisAIStrategy.update(timeStep,game);
  debugDrawZones();
}

Fixed version (ground truth):
@Override public void update(TimeStep timeStep){
  for (int i=0; i < brains.length; i++) {
    Brain brain=brains[i];
    if (brain != null) {
      brain.update(timeStep);
    }
  }
  this.alliedAIStrategy.update(timeStep,game);
  this.axisAIStrategy.update(timeStep,game);
}
Program: 86864
Project: 86864
Buggy source:
/** 
 * Listen for sounds
 */
private void listen(){
  if (timeToHear <= 0) {
    this.sounds.clear();
    List<SoundEmittedEvent> emittedSounds=world.getSoundEvents();
    if (!emittedSounds.isEmpty()) {
      this.entity.getHeardSounds(emittedSounds,this.sounds);
    }
    memory.store(HEARING,this.sounds);
    this.timeToHear=REFRESH_TIME;
  }
}

Fixed version (ground truth):
/** 
 * Listen for sounds
 */
private void listen(){
  if (timeToHear <= 0) {
    this.sounds.clear();
    SoundEventPool emittedSounds=world.getSoundEvents();
    if (emittedSounds.hasSounds()) {
      this.entity.getHeardSounds(emittedSounds,this.sounds);
    }
    memory.store(HEARING,this.sounds);
    this.timeToHear=REFRESH_TIME;
  }
}
Program: 86865
Project: 86865
Buggy source:
/** 
 * @param entities
 * @param map
 * @param graph
 */
public World(GameInfo game,Zones zones,Goals goals){
  super();
  this.game=game;
  this.zones=zones;
  this.goals=goals;
  this.entities=game.getEntities();
  this.players=game.getPlayerEntities();
  this.map=game.getMap();
  this.graph=game.getGraph();
  this.random=game.getRandom();
  this.tiles=new ArrayList<Tile>();
  this.tileBounds=new Rectangle();
  this.tileBounds.setWidth(map.getTileWidth());
  this.tileBounds.setHeight(map.getTileHeight());
  this.lastFramesSounds=new ArrayList<SoundEmittedEvent>();
  this.attackDirections=new ArrayList<AttackDirection>();
  this.activeBombs=new ArrayList<BombTarget>();
}

Fixed version (ground truth):
/** 
 * @param entities
 * @param map
 * @param graph
 */
public World(GameInfo game,Zones zones,Goals goals){
  super();
  this.game=game;
  this.zones=zones;
  this.goals=goals;
  this.entities=game.getEntities();
  this.players=game.getPlayerEntities();
  this.map=game.getMap();
  this.graph=game.getGraph();
  this.random=game.getRandom();
  this.tiles=new ArrayList<Tile>();
  this.tileBounds=new Rectangle();
  this.tileBounds.setWidth(map.getTileWidth());
  this.tileBounds.setHeight(map.getTileHeight());
  this.lastFramesSounds=new SoundEventPool(SeventhConstants.MAX_SOUNDS);
  this.attackDirections=new ArrayList<AttackDirection>();
  this.activeBombs=new ArrayList<BombTarget>();
}
Program: 86866
Project: 86866
Buggy source:
/** 
 * @return the soundEvents
 */
public List<SoundEmittedEvent> getSoundEvents(){
  this.lastFramesSounds.clear();
  this.lastFramesSounds.addAll(this.game.getLastFramesSoundEvents());
  this.lastFramesSounds.addAll(this.game.getSoundEvents());
  return this.lastFramesSounds;
}

Fixed version (ground truth):
/** 
 * @return the soundEvents
 */
public SoundEventPool getSoundEvents(){
  this.lastFramesSounds.clear();
  this.lastFramesSounds.set(this.game.getLastFramesSoundEvents());
  this.lastFramesSounds.set(this.game.getSoundEvents());
  return this.lastFramesSounds;
}
Program: 86868
Project: 86868
Buggy source:
public void updatePartialStats(NetPlayerPartialStat state){
  this.stats.deaths=state.deaths;
  this.stats.kills=state.kills;
  if (this.team.getId() != this.stats.teamId) {
    changeTeam(ClientTeam.fromId(this.stats.teamId));
  }
}

Fixed version (ground truth):
public void updatePartialStats(NetPlayerPartialStat state){
  this.stats.deaths=state.deaths;
  this.stats.kills=state.kills;
}
Program: 86869
Project: 86869
Buggy source:
@Override public List<SoundEmittedEvent> getSoundEvents(){
  return soundEvents;
}

Fixed version (ground truth):
@Override public SoundEventPool getSoundEvents(){
  return soundEvents;
}
Program: 86871
Project: 86871
Buggy source:
/** 
 * Invoked after an update, a hack to work around processing event queue
 */
public void postUpdate(){
  lastFramesSoundEvents.clear();
  lastFramesSoundEvents.addAll(soundEvents);
  soundEvents.clear();
  lastValidId=0;
}

Fixed version (ground truth):
/** 
 * Invoked after an update, a hack to work around processing event queue
 */
public void postUpdate(){
  lastFramesSoundEvents.clear();
  lastFramesSoundEvents.set(soundEvents);
  soundEvents.clear();
  lastValidId=0;
}
Program: 86873
Project: 86873
Buggy source:
@Override public List<SoundEmittedEvent> getLastFramesSoundEvents(){
  return lastFramesSoundEvents;
}

Fixed version (ground truth):
@Override public SoundEventPool getLastFramesSoundEvents(){
  return lastFramesSoundEvents;
}
Program: 86874
Project: 86874
Buggy source:
@Override @EventMethod public void onSoundEmitted(SoundEmittedEvent event){
  soundEvents.add(event);
}

Fixed version (ground truth):
@Override @EventMethod public void onSoundEmitted(SoundEmittedEvent event){
  soundEvents.emitSound(event);
}
Program: 86875
Project: 86875
Buggy source:
/** 
 * Emits a sound for the client to hear
 * @param sound
 * @param pos
 */
public void emitSound(int id,SoundType sound,Vector2f pos){
  soundEvents.add(new SoundEmittedEvent(this,id,sound,pos));
}

Fixed version (ground truth):
/** 
 * Emits a sound for the client to hear
 * @param sound
 * @param pos
 */
public void emitSound(int id,SoundType sound,Vector2f pos){
  soundEvents.emitSound(id,sound,pos);
}
Program: 86876
Project: 86876
Buggy source:
/** 
 * Applies the remote   {@link UserInputMessage} to the {@link PlayerEntity}
 * @param playerId
 * @param msg
 */
public void applyPlayerInput(int playerId,UserInputMessage msg){
  Player player=this.players.getPlayer(playerId);
  if (player != null) {
    if (player.isAlive()) {
      PlayerEntity entity=player.getEntity();
      entity.handleUserCommand(msg.keys,msg.orientation);
    }
 else     if (player.isSpectating()) {
      if (Keys.LEFT.isDown(this.previousKeys) && !Keys.LEFT.isDown(msg.keys)) {
        Player spectateMe=gameType.getNextPlayerToSpectate(getPlayers(),player);
        player.setSpectating(spectateMe);
      }
 else       if (Keys.RIGHT.isDown(this.previousKeys) && !Keys.RIGHT.isDown(msg.keys)) {
        Player spectateMe=gameType.getNextPlayerToSpectate(getPlayers(),player);
        player.setSpectating(spectateMe);
      }
      this.previousKeys=msg.keys;
    }
  }
}

Fixed version (ground truth):
/** 
 * Applies the remote   {@link UserInputMessage} to the {@link PlayerEntity}
 * @param playerId
 * @param msg
 */
public void applyPlayerInput(int playerId,UserInputMessage msg){
  Player player=this.players.getPlayer(playerId);
  if (player != null) {
    if (player.isAlive()) {
      PlayerEntity entity=player.getEntity();
      entity.handleUserCommand(msg.keys,msg.orientation);
    }
 else     if (player.isSpectating()) {
      if (Keys.LEFT.isDown(this.previousKeys) && !Keys.LEFT.isDown(msg.keys)) {
        Player spectateMe=gameType.getPrevPlayerToSpectate(getPlayers(),player);
        player.setSpectating(spectateMe);
      }
 else       if (Keys.RIGHT.isDown(this.previousKeys) && !Keys.RIGHT.isDown(msg.keys)) {
        Player spectateMe=gameType.getNextPlayerToSpectate(getPlayers(),player);
        player.setSpectating(spectateMe);
      }
      this.previousKeys=msg.keys;
    }
  }
}
Program: 86877
Project: 86877
Buggy source:
@Override public Player getPrevAlivePlayerFrom(Player oldPlayer){
  return getNextAlivePlayerFrom(oldPlayer);
}

Fixed version (ground truth):
@Override public Player getPrevAlivePlayerFrom(Player oldPlayer){
  if (oldPlayer == null)   return getRandomAlivePlayer();
  int nextPlayerIndex=(oldPlayer.getId() - 1) % players.length;
  if (nextPlayerIndex < 0) {
    nextPlayerIndex=Math.max(players.length - 1,0);
  }
  for (int i=0; i < this.players.length; i++) {
    Player player=this.players[nextPlayerIndex];
    if (player != null) {
      if (player.isAlive() && player != oldPlayer) {
        return player;
      }
    }
    nextPlayerIndex=(nextPlayerIndex - 1) % players.length;
    if (nextPlayerIndex < 0) {
      nextPlayerIndex=Math.max(players.length - 1,0);
    }
  }
  return null;
}
Program: 86878
Project: 86878
Buggy source:
@Override public Player getNextAlivePlayerFrom(Player oldPlayer){
  if (oldPlayer == null)   return getRandomAlivePlayer();
  boolean found=false;
  for (int i=0; i < this.players.length; i++) {
    Player player=this.players[i];
    if (player == null) {
      continue;
    }
    if (oldPlayer.getId() == player.getId()) {
      found=true;
    }
 else     if (found) {
      if (player.isAlive()) {
        return player;
      }
    }
  }
  if (!found) {
    return getRandomAlivePlayer();
  }
  return null;
}

Fixed version (ground truth):
@Override public Player getNextAlivePlayerFrom(Player oldPlayer){
  if (oldPlayer == null)   return getRandomAlivePlayer();
  int nextPlayerIndex=(oldPlayer.getId() + 1) % players.length;
  for (int i=0; i < this.players.length; i++) {
    Player player=this.players[nextPlayerIndex];
    if (player != null) {
      if (player.isAlive() && player != oldPlayer) {
        return player;
      }
    }
    nextPlayerIndex=(nextPlayerIndex + 1) % players.length;
  }
  return null;
}
Program: 86879
Project: 86879
Buggy source:
/** 
 * The next alive player from the supplied Player slot
 * @param old
 * @return the next alive player, or null if no player is alive
 */
public Player getNextAlivePlayerFrom(Player old){
  boolean found=false;
  boolean firstIteration=true;
  for (int i=0; i < this.players.size(); i++) {
    Player player=this.players.get(i);
    if (firstIteration) {
      if (old.getId() == player.getId()) {
        found=true;
      }
 else       if (found) {
        if (player.isAlive()) {
          return player;
        }
      }
      if (i >= this.players.size() - 1) {
        i=0;
        firstIteration=false;
      }
    }
 else {
      if (player.isAlive()) {
        return player;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * The next available alive player on this team from the 'oldPlayer'
 * @param oldPlayer
 * @return the next {@link Player} or null if none
 */
public Player getNextAlivePlayerFrom(Player oldPlayer){
  if (oldPlayer == null)   return getAlivePlayer();
  int nextPlayerIndex=players.indexOf(oldPlayer);
  if (nextPlayerIndex < 0) {
    nextPlayerIndex=0;
  }
  for (int i=0; i < this.players.size(); i++) {
    Player player=this.players.get(nextPlayerIndex);
    if (player != null) {
      if (player.isAlive() && player != oldPlayer) {
        return player;
      }
    }
    nextPlayerIndex=(nextPlayerIndex + 1) % players.size();
  }
  return null;
}
Program: 86880
Project: 86880
Buggy source:
@Override public Player getNextPlayerToSpectate(Players players,Player spectator){
  if (spectator.isPureSpectator()) {
    return players.getRandomAlivePlayer();
  }
  Player player=spectator.getSpectating();
  return player != null ? spectator.getTeam().getNextAlivePlayerFrom(player) : spectator.getTeam().getAlivePlayer();
}

Fixed version (ground truth):
@Override public Player getNextPlayerToSpectate(Players players,Player spectator){
  if (spectator.isPureSpectator()) {
    return players.getNextAlivePlayerFrom(spectator.getSpectating());
  }
  Player player=spectator.getSpectating();
  return player != null ? spectator.getTeam().getNextAlivePlayerFrom(player) : spectator.getTeam().getAlivePlayer();
}
Program: 86881
Project: 86881
Buggy source:
/** 
 */
public WeightedThoughtProcess(TeamStrategy teamStrategy,Brain brain){
  Goals goals=brain.getWorld().getGoals();
  this.currentGoal=new ConcurrentGoal(new WeightedGoal(brain,new AttackActionEvaluator(goals,brain.getRandomRangeMin(0.85),0.7),new CommandActionEvaluator(goals,brain.getRandomRangeMin(0.8),0.8),new InvestigateActionEvaluator(goals,brain.getRandomRange(0.5,0.9),0.6),new ExploreActionEvaluator(goals,brain.getRandomRange(0.1,0.5),0.5)),new WeightedGoal(brain,new ReloadWeaponEvaluator(goals,brain.getRandomRange(0.3,0.8),0),new SwitchWeaponEvaluator(goals,brain.getRandomRange(0.3,0.8),0),new DoNothingEvaluator(goals,brain.getRandomRange(0.4,0.9),0)));
}

Fixed version (ground truth):
/** 
 */
public WeightedThoughtProcess(TeamStrategy teamStrategy,Brain brain){
  Goals goals=brain.getWorld().getGoals();
  this.currentGoal=new ConcurrentGoal(new WeightedGoal(brain,new AttackActionEvaluator(goals,brain.getRandomRangeMin(0.85),0.82),new CommandActionEvaluator(goals,brain.getRandomRangeMin(0.8),0.8),new InvestigateActionEvaluator(goals,brain.getRandomRange(0.5,0.9),0.6),new ExploreActionEvaluator(goals,brain.getRandomRange(0.1,0.5),0.5)),new WeightedGoal(brain,new ReloadWeaponEvaluator(goals,brain.getRandomRange(0.3,0.8),0),new SwitchWeaponEvaluator(goals,brain.getRandomRange(0.3,0.8),0),new DoNothingEvaluator(goals,brain.getRandomRange(0.4,0.9),0)));
}
Program: 86882
Project: 86882
Buggy source:
/** 
 * @param entity
 * @param target
 * @return determines if the enemy is in line of fire
 */
public boolean inLineOfFire(PlayerEntity entity,PlayerEntity target){
  return !map.lineCollides(entity.getCenterPos(),target.getCenterPos());
}

Fixed version (ground truth):
/** 
 * @param entity
 * @param target
 * @return determines if the enemy is in line of fire
 */
public boolean inLineOfFire(PlayerEntity entity,PlayerEntity target){
  return !map.lineCollides(entity.getCenterPos(),target.getCenterPos(),entity.getHeightMask());
}
Program: 86883
Project: 86883
Buggy source:
@Override public boolean isFinished(Brain brain){
  return !this.followMe.isAlive() || brain.getSensors().getSightSensor().timeSeenAgo(followMe) > timeSinceLastSeenExpireMSec;
}

Fixed version (ground truth):
@Override public boolean isFinished(Brain brain){
  SightSensor sight=brain.getSensors().getSightSensor();
  SightMemoryRecord mem=sight.getMemoryRecordFor(followMe);
  boolean isFinished=true;
  if (mem != null && mem.isValid()) {
    isFinished=mem.getTimeSeenAgo() > timeSinceLastSeenExpireMSec;
  }
  return !this.followMe.isAlive() || isFinished;
}
Program: 86884
Project: 86884
Buggy source:
@Override public void start(Brain brain){
}

Fixed version (ground truth):
@Override public void start(Brain brain){
  this.inLOF=brain.getTargetingSystem().targetInLineOfFire();
}
Program: 86885
Project: 86885
Buggy source:
@Override public boolean isFinished(Brain brain){
  return false;
}

Fixed version (ground truth):
@Override public boolean isFinished(Brain brain){
  return !this.inLOF;
}
Program: 86886
Project: 86886
Buggy source:
@Override public void update(Brain brain,TimeStep timeStep){
  this.timeHeld+=timeStep.getDeltaTime();
  if (this.timeHeld >= this.timeToHold) {
    belt.endFire();
    System.out.println("String_Node_Str" + this.timeToHold);
  }
}

Fixed version (ground truth):
@Override public void update(Brain brain,TimeStep timeStep){
  this.timeHeld+=timeStep.getDeltaTime();
  if (this.timeHeld >= this.timeToHold) {
    belt.endFire();
  }
}
Program: 86887
Project: 86887
Buggy source:
@Override public void update(Brain brain,TimeStep timeStep){
  this.updateEval.update(timeStep);
  if (this.updateEval.isTime()) {
    ActionEvaluator currentEvaluator=evaluate(brain);
    if (this.currentActiveEvaluator == null || this.isFinished(brain)) {
      boolean shouldChangeAction=false;
      if (this.bestEvalScore > this.currentScore) {
        double delta=this.bestEvalScore - this.currentScore;
        if (delta > 0.05) {
          shouldChangeAction=true;
        }
      }
      if (((currentEvaluator.getKeepBias() > this.currentActiveEvaluator.getKeepBias() || shouldChangeAction) && (currentEvaluator != this.currentActiveEvaluator))) {
        this.currentActiveEvaluator=currentEvaluator;
        this.currentScore=this.bestEvalScore;
        Action action=this.currentActiveEvaluator.getAction(brain);
        if (!(action instanceof WaitAction))         System.out.println(action.getClass().getSimpleName());
        this.replace(action);
      }
    }
  }
  super.update(brain,timeStep);
}

Fixed version (ground truth):
@Override public void update(Brain brain,TimeStep timeStep){
  this.updateEval.update(timeStep);
  if (this.updateEval.isTime()) {
    ActionEvaluator newEvaluator=evaluate(brain);
    if (this.currentActiveEvaluator == null || this.isFinished(brain) || ((newEvaluator.getKeepBias() > this.currentActiveEvaluator.getKeepBias()) && (newEvaluator != this.currentActiveEvaluator))) {
      this.currentActiveEvaluator=newEvaluator;
      Action action=this.currentActiveEvaluator.getAction(brain);
      this.replace(action);
    }
  }
  super.update(brain,timeStep);
}
Program: 86888
Project: 86888
Buggy source:
private ActionEvaluator evaluate(Brain brain){
  double highestDesire=0;
  ActionEvaluator bestEval=null;
  int size=this.evaluators.size();
  for (int i=0; i < size; i++) {
    ActionEvaluator eval=this.evaluators.get(i);
    double desire=eval.calculateDesirability(brain);
    if (bestEval == null || desire > highestDesire) {
      bestEval=eval;
      highestDesire=desire;
    }
  }
  this.bestEvalScore=highestDesire;
  return bestEval;
}

Fixed version (ground truth):
private ActionEvaluator evaluate(Brain brain){
  double highestDesire=0;
  ActionEvaluator bestEval=null;
  int size=this.evaluators.size();
  for (int i=0; i < size; i++) {
    ActionEvaluator eval=this.evaluators.get(i);
    double desire=eval.calculateDesirability(brain);
    if (bestEval == null || desire > highestDesire) {
      bestEval=eval;
      highestDesire=desire;
    }
  }
  return bestEval;
}
Program: 86889
Project: 86889
Buggy source:
@Override public double calculateDesirability(Brain brain){
  double desirability=0;
  if (brain.getTargetingSystem().hasTarget()) {
    final double tweaker=1.0;
    desirability=tweaker * Evaluators.healthScore(brain.getEntityOwner()) * Evaluators.currentWeaponAmmoScore(brain.getEntityOwner());
    desirability*=getCharacterBias();
  }
  return desirability;
}

Fixed version (ground truth):
@Override public double calculateDesirability(Brain brain){
  double desirability=0;
  if (brain.getTargetingSystem().hasTarget()) {
    final double tweaker=1.0;
    desirability=tweaker * Math.max(Evaluators.healthScore(brain.getEntityOwner()),0.7) * Math.max(Evaluators.currentWeaponAmmoScore(brain.getEntityOwner()),0.8);
    desirability*=getCharacterBias();
  }
  return desirability;
}
Program: 86890
Project: 86890
Buggy source:
@Override public double calculateDesirability(Brain brain){
  double desirability=0.0;
  Communicator comms=brain.getCommunicator();
  if (comms.hasPendingCommands()) {
    desirability+=brain.getRandomRange(0.8,0.9);
  }
  desirability*=getCharacterBias();
  return desirability;
}

Fixed version (ground truth):
@Override public double calculateDesirability(Brain brain){
  double desirability=0.0;
  Communicator comms=brain.getCommunicator();
  if (comms.hasPendingCommands()) {
    desirability+=brain.getRandomRange(0.6,0.8);
  }
  desirability*=getCharacterBias();
  return desirability;
}
Program: 86891
Project: 86891
Buggy source:
/** 
 * @param fireAtMe the fireAtMe to set
 */
public void reset(Entity fireAtMe){
  this.fireAtMe=fireAtMe;
  this.getActionResult().setFailure();
}

Fixed version (ground truth):
/** 
 * @param fireAtMe the fireAtMe to set
 */
public void reset(Entity fireAtMe){
  this.fireAtMe=fireAtMe;
  this.lastContactTime=0;
  this.getActionResult().setFailure();
}
Program: 86892
Project: 86892
Buggy source:
public long getAvgBitsPerSecSent(){
  long totalTimeConnected=System.currentTimeMillis() - this.timeConnected;
  return (long)((numberOfBytesSent * 8) / (totalTimeConnected / 1000));
}

Fixed version (ground truth):
public long getAvgBitsPerSecSent(){
  long totalTimeConnected=(System.currentTimeMillis() - this.timeConnected) / 1000;
  if (totalTimeConnected > 0) {
    return (long)((numberOfBytesSent * 8) / totalTimeConnected);
  }
  return 0;
}
Program: 86893
Project: 86893
Buggy source:
public long getAvgBitsPerSecRecv(){
  long totalTimeConnected=System.currentTimeMillis() - this.timeConnected;
  return (long)((numberOfBytesRecv * 8) / (totalTimeConnected / 1000));
}

Fixed version (ground truth):
public long getAvgBitsPerSecRecv(){
  long totalTimeConnected=(System.currentTimeMillis() - this.timeConnected) / 1000;
  if (totalTimeConnected > 0) {
    return (long)((numberOfBytesRecv * 8) / totalTimeConnected);
  }
  return 0;
}