nus-yam/ex-repair huggingface dataset:
Program: 86777
Project: 86777
Buggy source:
/** 
 * Creates a new   {@link Bullet}
 * @param isPiercing
 * @return the {@link Bullet}
 */
protected Entity newBullet(boolean isPiercing){
  Vector2f pos=newBulletPosition();
  Vector2f vel=calculateVelocity(owner.getFacing());
  final int speed=1500 + (random.nextInt(10) * 100);
  Bullet bullet=new Bullet(pos,speed,game,owner,vel,damage,isPiercing);
  bullet.setMaxDistance(getBulletRange());
  game.addEntity(bullet);
  return bullet;
}

Fixed version (ground truth):
/** 
 * Creates a new   {@link Bullet}
 * @param isPiercing
 * @return the {@link Bullet}
 */
protected Bullet newBullet(boolean isPiercing){
  Vector2f pos=newBulletPosition();
  Vector2f vel=calculateVelocity(owner.getFacing());
  final int speed=1500 + (random.nextInt(10) * 100);
  Bullet bullet=new Bullet(pos,speed,game,owner,vel,damage,isPiercing);
  bullet.setMaxDistance(getBulletRange());
  game.addEntity(bullet);
  return bullet;
}
Program: 86778
Project: 86778
Buggy source:
/** 
 * Spawns a new   {@link Rocket}
 * @return the {@link Rocket}
 */
protected Entity newRocket(){
  Vector2f pos=newRocketPosition();
  Vector2f vel=calculateVelocity(owner.getFacing());
  final int speed=650;
  final int splashDamage=80;
  Entity bullet=new Rocket(pos,speed,game,owner,vel,damage,splashDamage);
  game.addEntity(bullet);
  return bullet;
}

Fixed version (ground truth):
/** 
 * Spawns a new   {@link Rocket}
 * @return the {@link Rocket}
 */
protected Rocket newRocket(){
  Vector2f pos=newRocketPosition();
  Vector2f vel=calculateVelocity(owner.getFacing());
  final int speed=650;
  final int splashDamage=80;
  Rocket bullet=new Rocket(pos,speed,game,owner,vel,damage,splashDamage);
  game.addEntity(bullet);
  return bullet;
}
Program: 86779
Project: 86779
Buggy source:
/** 
 * @param entity
 * @param x
 * @param y
 * @param width
 * @param height
 * @param notIn
 * @return a random position anywhere in the supplied bounds and not in the supplied {@link Rectangle}
 */
public Vector2f getRandomSpotNotIn(Entity entity,int x,int y,int width,int height,Rectangle notIn){
  Vector2f pos=new Vector2f(x + random.nextInt(width),y + random.nextInt(height));
  Rectangle temp=new Rectangle(entity.getBounds());
  temp.setLocation(pos);
  while ((map.rectCollides(temp) && !map.hasWorldCollidableTile(temp.x,temp.y)) || notIn.intersects(temp)) {
    pos.x=x + random.nextInt(width);
    pos.y=y + random.nextInt(height);
    temp.setLocation(pos);
  }
  return pos;
}

Fixed version (ground truth):
/** 
 * @param entity
 * @param x
 * @param y
 * @param width
 * @param height
 * @param notIn
 * @return a random position anywhere in the supplied bounds and not in the supplied {@link Rectangle}
 */
public Vector2f getRandomSpotNotIn(Entity entity,int x,int y,int width,int height,Rectangle notIn){
  return game.findFreeRandomSpotNotIn(entity,x,y,width,height,notIn);
}
Program: 86780
Project: 86780
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){
}

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){
  return game.findFreeRandomSpot(entity,x,y,width,height);
}
Program: 86781
Project: 86781
Buggy source:
@Override public void updateState(NetEntity state,long time){
  super.updateState(state,time);
  if (state instanceof NetPlayer) {
    NetPlayer ps=(NetPlayer)state;
    this.currentState=State.fromNetValue(ps.state);
    int newHealth=ps.health;
    this.damageDelta=newHealth - this.health;
    this.health=ps.health;
    this.stamina=ps.stamina;
    this.numberOfGrenades=ps.grenades;
    if (ps.isOperatingVehicle) {
      if (this.vehicle == null || this.vehicle.getId() != ps.vehicleId) {
        this.vehicle=game.getVehicleById(ps.vehicleId);
      }
    }
 else {
      updateWeaponState(ps.weapon,time);
    }
  }
 else {
    NetPlayerPartial ps=(NetPlayerPartial)state;
    this.currentState=State.fromNetValue(ps.state);
    int newHealth=ps.health;
    this.damageDelta=newHealth - this.health;
    this.health=ps.health;
    if (ps.isOperatingVehicle) {
      if (this.vehicle == null || this.vehicle.getId() != ps.vehicleId) {
        this.vehicle=game.getVehicleById(ps.vehicleId);
      }
    }
 else {
      updateWeaponState(ps.weapon,time);
    }
  }
}

Fixed version (ground truth):
@Override public void updateState(NetEntity state,long time){
  super.updateState(state,time);
  if (state instanceof NetPlayer) {
    NetPlayer ps=(NetPlayer)state;
    this.currentState=State.fromNetValue(ps.state);
    int newHealth=ps.health;
    this.damageDelta=newHealth - this.health;
    this.health=ps.health;
    this.stamina=ps.stamina;
    this.numberOfGrenades=ps.grenades;
    if (ps.isOperatingVehicle) {
      if (this.vehicle == null || this.vehicle.getId() != ps.vehicleId) {
        this.vehicle=game.getVehicleById(ps.vehicleId);
      }
    }
 else {
      this.vehicle=null;
      updateWeaponState(ps.weapon,time);
    }
  }
 else {
    NetPlayerPartial ps=(NetPlayerPartial)state;
    this.currentState=State.fromNetValue(ps.state);
    int newHealth=ps.health;
    this.damageDelta=newHealth - this.health;
    this.health=ps.health;
    if (ps.isOperatingVehicle) {
      if (this.vehicle == null || this.vehicle.getId() != ps.vehicleId) {
        this.vehicle=game.getVehicleById(ps.vehicleId);
      }
    }
 else {
      updateWeaponState(ps.weapon,time);
    }
  }
}
Program: 86783
Project: 86783
Buggy source:
/** 
 * @param pos
 * @param timeToLive
 * @param timeToNextSpawn
 */
public RocketTrailEmitter(Vector2f pos,int timeToLive,int timeToNextSpawn){
  super(pos,timeToLive,timeToNextSpawn);
  setDieInstantly(false);
  width=Art.smokeImage.getRegionWidth();
  height=Art.smokeImage.getRegionHeight();
}

Fixed version (ground truth):
/** 
 * @param pos
 * @param timeToLive
 * @param timeToNextSpawn
 */
public RocketTrailEmitter(Vector2f pos,int timeToLive,int timeToNextSpawn,int width,int height){
  super(pos,timeToLive,timeToNextSpawn);
  setDieInstantly(false);
  this.width=width;
  this.height=height;
}
Program: 86785
Project: 86785
Buggy source:
private void renderAnimation(Canvas canvas,AnimatedImage animation){
  if (animation != null) {
    int fontColor=theme.getForegroundColor();
    TextureRegion frame=animation.getCurrentImage();
    int x=canvas.getWidth() / 2 - frame.getRegionWidth() / 2;
    int y=canvas.getHeight() / 2 - frame.getRegionWidth();
    canvas.drawRect(x,y,frame.getRegionWidth(),frame.getRegionHeight(),0xff00ff00);
    canvas.drawImage(frame,x,y,null);
    canvas.setFont("String_Node_Str",14);
    String message=frame.getRegionWidth() + "String_Node_Str";
    canvas.drawString(message,x + (frame.getRegionWidth() / 2) - canvas.getWidth(message) / 2,y + frame.getRegionHeight() + canvas.getHeight("String_Node_Str"),fontColor);
    message=frame.getRegionHeight() + "String_Node_Str";
    canvas.drawString(message,x + frame.getRegionWidth() + 5,y + (frame.getRegionHeight() / 2) + canvas.getHeight("String_Node_Str") / 2,fontColor);
    renderAnimationWheel(canvas,frame);
  }
}

Fixed version (ground truth):
private void renderAnimation(Canvas canvas,AnimatedImage animation){
  if (animation != null) {
    int fontColor=theme.getForegroundColor();
    TextureRegion frame=animation.getCurrentImage();
    int x=canvas.getWidth() / 2 - frame.getRegionWidth() / 2;
    int y=canvas.getHeight() / 2 - frame.getRegionWidth();
    canvas.drawImage(frame,x,y,null);
    canvas.setFont("String_Node_Str",14);
    String message=frame.getRegionWidth() + "String_Node_Str";
    canvas.drawString(message,x + (frame.getRegionWidth() / 2) - canvas.getWidth(message) / 2,y + frame.getRegionHeight() + canvas.getHeight("String_Node_Str"),fontColor);
    message=frame.getRegionHeight() + "String_Node_Str";
    canvas.drawString(message,x + frame.getRegionWidth() + 5,y + (frame.getRegionHeight() / 2) + canvas.getHeight("String_Node_Str") / 2,fontColor);
    renderAnimationWheel(canvas,frame);
  }
}
Program: 86786
Project: 86786
Buggy source:
@Override public void start(Brain brain){
  Bomb bomb=target.getBomb();
  if (bomb == null) {
    this.getActionResult().setFailure();
    return;
  }
  World world=brain.getWorld();
  PlayerEntity bot=brain.getEntityOwner();
  Rectangle coverBounds=new Rectangle(300,300);
  coverBounds.centerAround(bot.getCenterPos());
  Vector2f moveTo=world.getRandomSpotNotIn(bot,coverBounds.x,coverBounds.y,coverBounds.width,coverBounds.height,bomb.getBlastRadius());
  getActionResult().setSuccess(moveTo);
}

Fixed version (ground truth):
@Override public void start(Brain brain){
  Bomb bomb=target.getBomb();
  if (bomb == null) {
    this.getActionResult().setFailure();
    return;
  }
  World world=brain.getWorld();
  PlayerEntity bot=brain.getEntityOwner();
  Rectangle coverBounds=new Rectangle(300,300);
  coverBounds.centerAround(target.getCenterPos());
  Vector2f moveTo=world.getRandomSpotNotIn(bot,coverBounds.x,coverBounds.y,coverBounds.width,coverBounds.height,bomb.getBlastRadius());
  getActionResult().setSuccess(moveTo);
}
Program: 86787
Project: 86787
Buggy source:
@Override public boolean isFinished(Brain brain){
  PathPlanner<?> path=brain.getMotion().getPathPlanner();
  return path.atDestination();
}

Fixed version (ground truth):
@Override public boolean isFinished(Brain brain){
  PathPlanner<?> path=brain.getMotion().getPathPlanner();
  boolean isFinished=path.atDestination();
  if (isFinished) {
    getActionResult().setSuccess();
  }
  return isFinished;
}
Program: 86788
Project: 86788
Buggy source:
/** 
 */
public MoveToBombAction(BombTarget bomb){
  super(bomb.getCenterPos());
}

Fixed version (ground truth):
/** 
 * @param target 
 */
public MoveToBombAction(BombTarget target){
  super(target.getCenterPos());
}
Program: 86789
Project: 86789
Buggy source:
/** 
 * @param brain
 * @return the current marching orders
 */
private Action getCurrentAction(Brain brain){
  Action action=null;
  if (this.zoneToAttack == null) {
    this.zoneToAttack=calculateZoneToAttack();
  }
switch (this.currentState) {
case DEFEND:
    if (zoneToAttack != null) {
      BombTarget target=getPlantedBombTarget(zoneToAttack);
      if (target != null) {
        action=goals.defendPlantedBomb(target);
      }
 else {
        action=goals.defend(zoneToAttack);
      }
    }
  break;
case INFILTRATE:
if (zoneToAttack != null) {
  action=goals.infiltrate(zoneToAttack);
}
action=goals.goToRandomSpot(brain);
break;
case PLANT_BOMB:
action=goals.plantBomb();
break;
case RANDOM:
action=goals.goToRandomSpot(brain);
break;
case DONE:
default :
if (zoneToAttack != null) {
action=goals.infiltrate(zoneToAttack);
}
break;
}
return action;
}

Fixed version (ground truth):
/** 
 * @param brain
 * @return the current marching orders
 */
private Action getCurrentAction(Brain brain){
  Action action=null;
  if (this.zoneToAttack == null) {
    this.zoneToAttack=calculateZoneToAttack(brain);
  }
switch (this.currentState) {
case DEFEND:
    if (zoneToAttack != null) {
      BombTarget target=getPlantedBombTarget(zoneToAttack);
      if (target != null) {
        action=goals.defendPlantedBomb(target);
      }
 else {
        action=goals.defend(zoneToAttack);
      }
    }
  break;
case INFILTRATE:
if (zoneToAttack != null) {
  action=goals.infiltrate(zoneToAttack);
}
action=goals.goToRandomSpot(brain);
break;
case PLANT_BOMB:
action=goals.plantBomb();
break;
case RANDOM:
action=goals.goToRandomSpot(brain);
break;
case DONE:
default :
if (zoneToAttack != null) {
action=goals.infiltrate(zoneToAttack);
}
break;
}
return action;
}
Program: 86790
Project: 86790
Buggy source:
/** 
 * @return determine which {@link Zone} to attack
 */
private Zone calculateZoneToAttack(){
  Zone zoneToAttack=null;
  List<Zone> zonesWithBombs=this.zones.getBombTargetZones();
  if (!zonesWithBombs.isEmpty()) {
    List<Zone> validZones=new ArrayList<>();
    for (    Zone zone : zonesWithBombs) {
      if (zone.isTargetsStillActive()) {
        validZones.add(zone);
      }
    }
    if (!validZones.isEmpty()) {
      zoneToAttack=validZones.get(random.nextInt(validZones.size()));
    }
  }
 else {
    zoneToAttack=stats.getDeadliesZone();
  }
  return zoneToAttack;
}

Fixed version (ground truth):
/** 
 * @return determine which {@link Zone} to attack
 */
private Zone calculateZoneToAttack(){
  Zone zoneToAttack=null;
  List<Zone> validZones=calculateZonesOfInterest();
  if (!validZones.isEmpty()) {
    zoneToAttack=validZones.get(random.nextInt(validZones.size()));
  }
 else {
    zoneToAttack=stats.getDeadliesZone();
  }
  return zoneToAttack;
}
Program: 86791
Project: 86791
Buggy source:
/** 
 * @return the estimated blast radius
 */
public Rectangle getBlastRadius(){
  int maxWidth=(this.splashWidth + this.maxSpread) * 2;
  this.blastRadius.setSize(maxWidth,maxWidth);
  this.blastRadius.centerAround(getCenterPos());
  return this.blastRadius;
}

Fixed version (ground truth):
/** 
 * @return the estimated blast radius
 */
public Rectangle getBlastRadius(){
  int maxWidth=(this.splashWidth + this.maxSpread) * 4;
  this.blastRadius.setSize(maxWidth,maxWidth);
  this.blastRadius.centerAround(getCenterPos());
  return this.blastRadius;
}
Program: 86792
Project: 86792
Buggy source:
/** 
 * @param console
 * @param config
 */
public Terminal(Console console,ClientSeventhConfig config){
  this.console=console;
  this.console.addLogger(this);
  this.isActive=false;
  this.blinkTimer=new Timer(true,500);
  this.showCursor=true;
  this.background=new Rectangle();
  this.backgroundColor=config.getConsoleBackgroundColor();
  this.foregroundColor=config.getConsoleForegroundColor();
  this.textBuffer=new LinkedList<String>();
  this.inputBuffer=new StringBuilder();
  this.cmdHistory=new Stack<String>();
}

Fixed version (ground truth):
/** 
 * @param console
 * @param config
 */
public Terminal(Console console,ClientSeventhConfig config){
  this.console=console;
  this.console.addLogger(this);
  this.isActive=false;
  this.blinkTimer=new Timer(true,500);
  this.showCursor=true;
  this.background=new Rectangle();
  this.backgroundColor=config.getConsoleBackgroundColor();
  this.foregroundColor=config.getConsoleForegroundColor();
  this.textBuffer=new LinkedList<String>();
  this.inputBuffer=new StringBuilder();
  this.cmdHistory=new ArrayList<String>();
}
Program: 86793
Project: 86793
Buggy source:
public boolean keyTyped(char key){
  if (!isActive) {
    return false;
  }
switch (key) {
case 8:
{
      if (cursorIndex > 0) {
        inputBuffer.deleteCharAt(--cursorIndex);
        if (cursorIndex < 0) {
          cursorIndex=0;
        }
      }
      break;
    }
case 127:
{
    if (cursorIndex < inputBuffer.length()) {
      inputBuffer.deleteCharAt(cursorIndex);
    }
    break;
  }
case '\r':
case '\n':
{
  String command=inputBuffer.toString();
  cmdHistory.add(command);
  setInputText("String_Node_Str");
  console.execute(command);
  break;
}
default :
{
char c=key;
if (c > 31 && c < 127 && c != 96) {
  inputBuffer.insert(cursorIndex,key);
  cursorIndex++;
}
}
}
return true;
}

Fixed version (ground truth):
public boolean keyTyped(char key){
  if (!isActive) {
    return false;
  }
switch (key) {
case 8:
{
      if (cursorIndex > 0) {
        inputBuffer.deleteCharAt(--cursorIndex);
        if (cursorIndex < 0) {
          cursorIndex=0;
        }
      }
      break;
    }
case 127:
{
    if (cursorIndex < inputBuffer.length()) {
      inputBuffer.deleteCharAt(cursorIndex);
    }
    break;
  }
case '\r':
case '\n':
{
  String command=inputBuffer.toString();
  cmdHistory.add(command);
  cmdHistoryIndex=cmdHistory.size() - 1;
  setInputText("String_Node_Str");
  console.execute(command);
  break;
}
default :
{
char c=key;
if (c > 31 && c < 127 && c != 96) {
  inputBuffer.insert(cursorIndex,key);
  cursorIndex++;
}
}
}
return true;
}
Program: 86796
Project: 86796
Buggy source:
@Override protected GameState doUpdate(Game game,TimeStep timeStep){
  if (GameState.IN_PROGRESS == getGameState()) {
    List<Team> leaders=getTeamsWithHighScore();
    if (this.getRemainingTime() <= 0 || leaders.get(0).getScore() >= getMaxScore()) {
      if (leaders.size() > 1) {
        setGameState(GameState.TIE);
      }
 else {
        setGameState(GameState.WINNER);
      }
    }
  }
  if (GameState.IN_PROGRESS == getGameState()) {
    Player[] players=game.getPlayers().getPlayers();
    for (int i=0; i < players.length; i++) {
      Player player=players[i];
      if (player != null) {
        if (player.isDead() && !player.isSpectating()) {
          player.updateSpawnTime(timeStep);
          if (player.readyToSpawn()) {
            game.spawnPlayerEntity(player.getId());
          }
        }
      }
    }
  }
  return getGameState();
}

Fixed version (ground truth):
@Override protected GameState doUpdate(Game game,TimeStep timeStep){
  if (GameState.IN_PROGRESS == getGameState()) {
    List<Team> leaders=getTeamsWithHighScore();
    boolean isUnlimitedScore=getMaxScore() <= 0;
    if (this.getRemainingTime() <= 0 || (leaders.get(0).getScore() >= getMaxScore() && !isUnlimitedScore)) {
      if (leaders.size() > 1) {
        setGameState(GameState.TIE);
      }
 else {
        setGameState(GameState.WINNER);
      }
    }
  }
  if (GameState.IN_PROGRESS == getGameState()) {
    Player[] players=game.getPlayers().getPlayers();
    for (int i=0; i < players.length; i++) {
      Player player=players[i];
      if (player != null) {
        if (player.isDead() && !player.isSpectating()) {
          player.updateSpawnTime(timeStep);
          if (player.readyToSpawn()) {
            game.spawnPlayerEntity(player.getId());
          }
        }
      }
    }
  }
  return getGameState();
}
Program: 86797
Project: 86797
Buggy source:
@Override public void damage(Entity damager,int amount){
  if (damager instanceof Explosion) {
    amount=1;
  }
 else   if (damager instanceof Rocket) {
    amount/=2;
  }
 else   if (damager instanceof Bullet) {
    amount=1;
  }
 else {
    amount/=10;
  }
  armor-=amount;
  if (armor < 0) {
    super.damage(damager,amount);
  }
}

Fixed version (ground truth):
@Override public void damage(Entity damager,int amount){
  if (damager instanceof Explosion) {
    amount=1;
  }
 else   if (damager instanceof Rocket) {
    amount/=2;
  }
 else   if (damager instanceof Bullet) {
    amount=0;
  }
 else {
    amount/=10;
  }
  armor-=amount;
  if (armor < 0) {
    super.damage(damager,amount);
  }
}
Program: 86798
Project: 86798
Buggy source:
/** 
 * @param game
 * @param owner
 * @param type
 */
public Railgun(Game game,Entity owner){
  super(game,owner,Type.RAILGUN);
  this.roundsPerSecond=15;
  this.damage=10;
  this.reloadTime=1600;
  this.clipSize=30;
  this.totalAmmo=180;
  this.spread=10;
  this.maxHeat=3000;
  this.bulletsInClip=this.clipSize;
  this.lineOfSight=WeaponConstants.THOMPSON_LINE_OF_SIGHT;
  this.weaponWeight=WeaponConstants.THOMPSON_WEIGHT;
  this.netWeapon.type=Type.RAILGUN.netValue();
  applyScriptAttributes("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param game
 * @param owner
 * @param type
 */
public Railgun(Game game,Entity owner){
  super(game,owner,Type.RAILGUN);
  this.roundsPerSecond=15;
  this.damage=40;
  this.reloadTime=1600;
  this.clipSize=30;
  this.totalAmmo=180;
  this.spread=10;
  this.maxHeat=3000;
  this.bulletsInClip=this.clipSize;
  this.lineOfSight=WeaponConstants.THOMPSON_LINE_OF_SIGHT;
  this.weaponWeight=WeaponConstants.THOMPSON_WEIGHT;
  this.netWeapon.type=Type.RAILGUN.netValue();
  applyScriptAttributes("String_Node_Str");
}
Program: 86799
Project: 86799
Buggy source:
@Override public void execute(Console console,String... args){
switch (args.length) {
case 0:
    console.println("String_Node_Str");
  break;
case 1:
console.println(args[0] + "String_Node_Str" + config.getConfig().get(args[0]));
break;
default :
{
try {
config.getConfig().set(Integer.parseInt(args[1]),args[0]);
}
 catch (Exception e) {
console.println("String_Node_Str");
}
}
}
}

Fixed version (ground truth):
@Override public void execute(Console console,String... args){
  if (getServerContext().hasGameSession()) {
    GameSession session=getServerContext().getGameSession();
    Game game=session.getGame();
    if (game != null) {
switch (args.length) {
case 0:
        console.println("String_Node_Str");
      break;
case 1:
    console.execute("String_Node_Str" + args[0]);
  break;
case 2:
console.execute("String_Node_Str" + args[0]);
console.execute("String_Node_Str" + args[1]);
break;
case 3:
console.execute("String_Node_Str" + args[0]);
console.execute("String_Node_Str" + args[1]);
console.execute("String_Node_Str" + args[2]);
break;
default :
{
console.println("String_Node_Str");
}
}
}
}
}
Program: 86801
Project: 86801
Buggy source:
/** 
 * Sets the orientation to move in order for the Entity to look at the dest vector.
 * @param me
 * @param dest
 */
public void reset(Entity me,Vector2f dest){
  this.destinationOrientation=Entity.getAngleBetween(dest,me.getPos());
}

Fixed version (ground truth):
/** 
 * Sets the orientation to move in order for the Entity to look at the dest vector.
 * @param me
 * @param dest
 */
public void reset(Entity me,Vector2f dest){
  this.destinationOrientation=Entity.getAngleBetween(dest,me.getPos());
  final float fullCircle=FastMath.fullCircle;
  if (this.destinationOrientation < 0) {
    this.destinationOrientation+=fullCircle;
  }
}
Program: 86802
Project: 86802
Buggy source:
/** 
 * @param game
 * @param pos
 */
public ClientBullet(ClientGame game,Vector2f pos){
  super(game,pos);
  origin=new Vector2f(pos);
  oldPos=new Vector2f(pos);
  renderPosEnd=new Vector2f();
  renderPosStart=new Vector2f();
  Random random=game.getRandom();
  trailSize=random.nextInt(2) + 1;
  setOnRemove(new BulletOnRemove());
}

Fixed version (ground truth):
/** 
 * @param game
 * @param pos
 */
public ClientBullet(ClientGame game,Vector2f pos){
  super(game,pos);
  origin=new Vector2f(pos);
  oldPos=new Vector2f(pos);
  renderPosEnd=new Vector2f();
  renderPosStart=new Vector2f();
  Random random=game.getRandom();
  trailSize=random.nextInt(2) + 1;
  bounds.width=5;
  bounds.height=5;
  setOnRemove(new BulletOnRemove());
}
Program: 86803
Project: 86803
Buggy source:
/** 
 * checks to see if there are any bullets shooting by the player, if there are, it plays some bullet zing sounds
 * @param timeStep
 */
public void checkForBulletZings(TimeStep timeStep){
  long gameClock=timeStep.getGameClock();
  ClientControllableEntity localEntity=game.getLocalPlayerFollowingEntity();
  if (localEntity != null) {
    ClientEntity[] entityList=game.getEntities().getEntities();
    int size=entityList.length;
    for (int i=0; i < size; i++) {
      ClientEntity ent=entityList[i];
      if (ent != null) {
        if (ent instanceof ClientBullet) {
          if (ent.isAlive() && ent.getLastUpdate() + 200 > gameClock) {
            if (localEntity.inEarShot(ent)) {
              zings[ent.id].playZing(gameClock,localEntity.id,ent);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * checks to see if there are any bullets shooting by the player, if there are, it plays some bullet zing sounds
 * @param timeStep
 */
public void checkForBulletZings(TimeStep timeStep){
  long gameClock=timeStep.getGameClock();
  ClientControllableEntity localEntity=game.getLocalPlayerFollowingEntity();
  if (localEntity != null) {
    ClientEntity[] entityList=game.getEntities().getEntities();
    int size=entityList.length;
    for (int i=0; i < size; i++) {
      ClientEntity ent=entityList[i];
      if (ent != null) {
        if (ent instanceof ClientBullet) {
          ClientBullet bullet=(ClientBullet)ent;
          if (ent.isAlive() && ent.getLastUpdate() + 200 > gameClock && bullet.getOwnerId() != localEntity.id) {
            if (localEntity.inEarShot(ent)) {
              zings[ent.id].playZing(gameClock,localEntity.id,ent);
            }
          }
        }
      }
    }
  }
}
Program: 86806
Project: 86806
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();
  }
}

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();
    debugDrawPathPlanner();
  }
}
Program: 86807
Project: 86807
Buggy source:
/** 
 * Finds a fuzzy (meaning not necessarily the most optimal but different) path between the start and end point
 * @param start
 * @param destination
 * @param the amount of fuzzy the add to the path (the greater the number the less efficient the path is to the destination)
 */
public void findFuzzyPath(Vector2f start,Vector2f destination,final int fuzzyness){
  this.fuzzySearchPath.actualFuzzy=Math.max(1,fuzzyness);
  this.finalDestination.set(destination);
  List<GraphNode<Tile,E>> newPath=this.graph.findFuzzyPath(this.fuzzySearchPath,start,destination,fuzzyness);
  setPath(newPath);
}

Fixed version (ground truth):
/** 
 * Finds a fuzzy (meaning not necessarily the most optimal but different) path between the start and end point
 * @param start
 * @param destination
 * @param the amount of fuzzy the add to the path (the greater the number the less efficient the path is to the destination)
 */
public void findFuzzyPath(Vector2f start,Vector2f destination,final int fuzzyness){
  this.fuzzySearchPath.actualFuzzy=Math.max(1,fuzzyness);
  List<GraphNode<Tile,E>> newPath=this.graph.findFuzzyPath(this.fuzzySearchPath,start,destination,fuzzyness);
  setPath(newPath);
  this.finalDestination.set(destination);
}
Program: 86808
Project: 86808
Buggy source:
private boolean isEntityOnTile(Tile tile){
  List<Player> teammates=world.getTeammates(brain);
  PlayerInfo bot=brain.getPlayer();
  int size=teammates.size();
  for (int i=0; i < size; i++) {
    if (bot.getId() != i) {
      Player p=teammates.get(i);
      if (p.isAlive()) {
        if (tile.getBounds().contains(p.getEntity().getCenterPos())) {
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private Entity isEntityOnTile(Tile tile){
  Entity ent=isVehicleOnTile(tile);
  if (ent == null) {
    ent=isTeammateOnTile(tile);
  }
  return ent;
}
Program: 86809
Project: 86809
Buggy source:
/** 
 * Finds a path, avoiding the supplied   {@link Zone}s
 * @param start
 * @param destination
 * @param zonesToAvoid
 */
public void findAvoidancePath(Vector2f start,Vector2f destination,List<Zone> zonesToAvoid){
  this.avoidSearchPath.zonesToAvoid=zonesToAvoid;
  this.finalDestination.set(destination);
  List<GraphNode<Tile,E>> newPath=this.graph.findPathAvoidZones(this.avoidSearchPath,start,destination,zonesToAvoid);
  setPath(newPath);
}

Fixed version (ground truth):
/** 
 * Finds a path, avoiding the supplied   {@link Zone}s
 * @param start
 * @param destination
 * @param zonesToAvoid
 */
public void findAvoidancePath(Vector2f start,Vector2f destination,List<Zone> zonesToAvoid){
  this.avoidSearchPath.zonesToAvoid=zonesToAvoid;
  List<GraphNode<Tile,E>> newPath=this.graph.findPathAvoidZones(this.avoidSearchPath,start,destination,zonesToAvoid);
  setPath(newPath);
  this.finalDestination.set(destination);
}
Program: 86810
Project: 86810
Buggy source:
/** 
 * Clears out the path
 */
public void clearPath(){
  this.currentNode=0;
  this.finalDestination.zeroOut();
  this.path.clear();
}

Fixed version (ground truth):
/** 
 * Clears out the path
 */
public void clearPath(){
  this.currentNode=0;
  this.finalDestination.zeroOut();
  this.path.clear();
  this.tilesToAvoid.clear();
}
Program: 86811
Project: 86811
Buggy source:
@Override protected boolean shouldIgnore(GraphNode<Tile,E> node){
  Tile tile=node.getValue();
  for (int i=0; i < zonesToAvoid.size(); i++) {
    Zone zone=zonesToAvoid.get(i);
    if (zone.getBounds().intersects(tile.getBounds())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override protected boolean shouldIgnore(GraphNode<Tile,E> node){
  Tile tile=node.getValue();
  for (int i=0; i < zonesToAvoid.size(); i++) {
    Zone zone=zonesToAvoid.get(i);
    if (zone.getBounds().intersects(tile.getBounds())) {
      return true;
    }
  }
  return shouldIgnoreTile(node.getValue());
}
Program: 86812
Project: 86812
Buggy source:
/** 
 * Calculate the estimated cost of the path from the start to destination
 * @param start
 * @param destination
 * @return the estimated cost of moving from start to destination
 */
public int pathCost(Vector2f start,Vector2f destination){
  this.fuzzySearchPath.actualFuzzy=1;
  this.finalDestination.set(destination);
  List<GraphNode<Tile,E>> newPath=this.graph.findPath(this.fuzzySearchPath,start,destination);
  int cost=newPath.size() * 32;
  return cost;
}

Fixed version (ground truth):
/** 
 * Calculate the estimated cost of the path from the start to destination
 * @param start
 * @param destination
 * @return the estimated cost of moving from start to destination
 */
public int pathCost(Vector2f start,Vector2f destination){
  this.fuzzySearchPath.actualFuzzy=1;
  List<GraphNode<Tile,E>> newPath=this.graph.findPath(this.fuzzySearchPath,start,destination);
  int cost=newPath.size() * 32;
  return cost;
}
Program: 86813
Project: 86813
Buggy source:
/** 
 * Gets the next destination vector
 * @param currentPosition
 * @return the next destination
 */
public Vector2f nextDestination(Vector2f currentPosition){
  Vector2fCopy(currentPosition,destination);
  if (!path.isEmpty() && currentNode < path.size()) {
    GraphNode<Tile,E> node=path.get(currentNode);
    Tile tile=node.getValue();
    int centerX=tile.getX();
    int centerY=tile.getY();
    if (Math.abs(centerX - (int)currentPosition.x) < 6 && Math.abs(centerY - (int)currentPosition.y) < 6) {
      currentNode++;
    }
    destination.x=(int)((tile.getX() - (int)currentPosition.x));
    destination.y=(int)((tile.getY() - (int)currentPosition.y));
  }
  return destination;
}

Fixed version (ground truth):
public Vector2f nextDestination(PlayerEntity ent){
  Vector2f cPos=ent.getCenterPos();
  int x=(int)cPos.x;
  int y=(int)cPos.y;
  destination.zeroOut();
  if (!path.isEmpty() && currentNode < path.size()) {
    GraphNode<Tile,E> node=path.get(currentNode);
    Tile tile=node.getValue();
    int centerX=tile.getX() + tile.getWidth() / 2;
    int centerY=tile.getY() + tile.getHeight() / 2;
    if (Math.abs(centerX - x) < 6 && Math.abs(centerY - y) < 6) {
      currentNode++;
      if (currentNode < path.size()) {
        tile=path.get(currentNode).getValue();
        Entity entOnTile=isEntityOnTile(tile);
        if (entOnTile != null) {
          world.getMap().getTilesInRect(entOnTile.getBounds(),tilesToAvoid);
          tilesToAvoid.add(tile);
          findPath(cPos,this.finalDestination);
          return nextDestination(ent);
        }
      }
    }
    destination.x=(centerX - x);
    destination.y=(centerY - y);
  }
  return destination;
}
Program: 86814
Project: 86814
Buggy source:
/** 
 * Finds the optimal path between the start and end point
 * @param start
 * @param destination
 */
public void findPath(Vector2f start,Vector2f destination){
  this.fuzzySearchPath.actualFuzzy=1;
  this.finalDestination.set(destination);
  List<GraphNode<Tile,E>> newPath=this.graph.findPath(this.fuzzySearchPath,start,destination);
  setPath(newPath);
}

Fixed version (ground truth):
/** 
 * Finds the optimal path between the start and end point
 * @param start
 * @param destination
 */
public void findPath(Vector2f start,Vector2f destination){
  this.fuzzySearchPath.actualFuzzy=1;
  List<GraphNode<Tile,E>> newPath=this.graph.findPath(this.fuzzySearchPath,start,destination);
  setPath(newPath);
  this.finalDestination.set(destination);
}
Program: 86815
Project: 86815
Buggy source:
/** 
 * @param path
 */
public PathPlanner(Brain brain,MapGraph<E> graph){
  this.brain=brain;
  this.world=brain.getWorld();
  this.graph=graph;
  this.finalDestination=new Vector2f();
  this.destination=new Vector2f();
  this.random=new Random();
  this.path=new ArrayList<GraphNode<Tile,E>>();
  this.currentNode=0;
  this.fuzzySearchPath=new FuzzySearchPath();
  this.avoidSearchPath=new AvoidSearchPath();
}

Fixed version (ground truth):
/** 
 * @param path
 */
public PathPlanner(Brain brain,MapGraph<E> graph){
  this.brain=brain;
  this.world=brain.getWorld();
  this.graph=graph;
  this.finalDestination=new Vector2f();
  this.destination=new Vector2f();
  this.random=new Random();
  this.path=new ArrayList<GraphNode<Tile,E>>();
  this.tilesToAvoid=new ArrayList<Tile>();
  this.currentNode=0;
  this.fuzzySearchPath=new FuzzySearchPath();
  this.avoidSearchPath=new AvoidSearchPath();
}
Program: 86816
Project: 86816
Buggy source:
@Override public double calculateDesirability(Brain brain){
  double desirability=0.0;
  SoundEmittedEvent sound=brain.getSensors().getSoundSensor().getClosestSound();
  if (sound != null) {
    desirability=0.35;
switch (sound.getSoundType()) {
case EXPLOSION:
case GRENADE_THROW:
case KAR98_FIRE:
case M1_GARAND_FIRE:
case MELEE_HIT:
case MELEE_SWING:
case MP40_FIRE:
case MP44_FIRE:
case PISTOL_FIRE:
case RISKER_FIRE:
case RPG_FIRE:
case SHOTGUN_FIRE:
case SPRINGFIELD_FIRE:
case THOMPSON_FIRE:
      desirability+=brain.getRandomRange(0.1,0.3);
    break;
case WEAPON_PICKUP:
case AMMO_PICKUP:
  desirability+=brain.getRandomRange(0.2,0.43);
break;
case WEAPON_DROPPED:
case WEAPON_SWITCH:
case THOMPSON_RELOAD:
case SPRINGFIELD_RECHAMBER:
case SPRINGFIELD_RELOAD:
case SHOTGUN_RELOAD:
case SHOTGUN_PUMP:
case RISKER_RELOAD:
case RISKER_RECHAMBER:
case PISTOL_RELOAD:
case MP44_RELOAD:
case MP40_RELOAD:
case M1_GARAND_RELOAD:
case KAR98_RELOAD:
case KAR98_RECHAMBER:
desirability+=brain.getRandomRange(0.4,0.45);
break;
case EMPTY_FIRE:
case GRENADE_PINPULLED:
case M1_GARAND_LAST_FIRE:
desirability+=brain.getRandomRange(0.4,0.5);
break;
case BOMB_DISARM:
case BOMB_PLANT:
desirability+=brain.getRandomRange(0.2,0.5);
break;
default :
}
}
desirability=Math.min(desirability,1f);
desirability*=getCharacterBias();
return desirability;
}

Fixed version (ground truth):
@Override public double calculateDesirability(Brain brain){
  double desirability=0.0;
  SoundEmittedEvent sound=brain.getSensors().getSoundSensor().getClosestSound();
  if (sound != null) {
    desirability=0.35;
switch (sound.getSoundType()) {
case EXPLOSION:
case GRENADE_THROW:
case KAR98_FIRE:
case M1_GARAND_FIRE:
case MELEE_HIT:
case MELEE_SWING:
case MP40_FIRE:
case MP44_FIRE:
case PISTOL_FIRE:
case RISKER_FIRE:
case RPG_FIRE:
case SHOTGUN_FIRE:
case SPRINGFIELD_FIRE:
case THOMPSON_FIRE:
      desirability+=brain.getRandomRange(0.1,0.3);
    break;
case WEAPON_PICKUP:
case AMMO_PICKUP:
  desirability+=brain.getRandomRange(0.2,0.43);
break;
case WEAPON_DROPPED:
case WEAPON_SWITCH:
case THOMPSON_RELOAD:
case SPRINGFIELD_RECHAMBER:
case SPRINGFIELD_RELOAD:
case SHOTGUN_RELOAD:
case SHOTGUN_PUMP:
case RISKER_RELOAD:
case RISKER_RECHAMBER:
case PISTOL_RELOAD:
case MP44_RELOAD:
case MP40_RELOAD:
case M1_GARAND_RELOAD:
case KAR98_RELOAD:
case KAR98_RECHAMBER:
desirability+=brain.getRandomRange(0.4,0.45);
break;
case EMPTY_FIRE:
case GRENADE_PINPULLED:
case M1_GARAND_LAST_FIRE:
desirability+=brain.getRandomRange(0.4,0.5);
break;
case BOMB_DISARM:
case BOMB_PLANT:
desirability+=brain.getRandomRange(0.2,0.5);
break;
case TANK_MOVE1:
case TANK_MOVE2:
case TANK_START_MOVE:
case TANK_TURRET_MOVE:
desirability=0f;
break;
default :
desirability=0.1f;
}
}
desirability=Math.min(desirability,1f);
desirability*=getCharacterBias();
return desirability;
}
Program: 86817
Project: 86817
Buggy source:
@Override public double calculateDesirability(Brain brain){
  double score=0;
  TargetingSystem system=brain.getTargetingSystem();
  if (system.hasTarget()) {
    PlayerEntity bot=brain.getEntityOwner();
    final double tweaker=1.0;
    score=tweaker * Evaluators.healthScore(bot) * Evaluators.currentWeaponAmmoScore(bot)* Evaluators.weaponDistanceScore(bot,system.getCurrentTarget());
    if (!system.currentTargetInLineOfFire()) {
      score*=0.9;
    }
    score*=getCharacterBias();
  }
  return score;
}

Fixed version (ground truth):
@Override public double calculateDesirability(Brain brain){
  double score=0;
  TargetingSystem system=brain.getTargetingSystem();
  if (system.hasTarget()) {
    PlayerEntity bot=brain.getEntityOwner();
    final double tweaker=1.0;
    final PlayerEntity enemy=system.getCurrentTarget();
    if (enemy.isOperatingVehicle()) {
      score=0;
    }
 else {
      score=tweaker * Evaluators.healthScore(bot) * Evaluators.currentWeaponAmmoScore(bot)* Evaluators.weaponDistanceScore(bot,enemy);
    }
    if (!system.currentTargetInLineOfFire()) {
      score*=0.9;
    }
    score*=getCharacterBias();
  }
  return score;
}
Program: 86818
Project: 86818
Buggy source:
@Override public double calculateDesirability(Brain brain){
  double score=0;
  TargetingSystem system=brain.getTargetingSystem();
  if (system.hasTarget()) {
    PlayerEntity bot=brain.getEntityOwner();
    final double tweaker=1.0;
    score=tweaker * 1.0 - Evaluators.healthScore(bot) * 1.0 - Evaluators.currentWeaponAmmoScore(bot) * 1.0 - Evaluators.weaponDistanceScore(bot,system.getCurrentTarget());
    Vector2f lastSeenAt=system.getLastRemeberedPosition();
    if (lastSeenAt != null) {
    }
    if (!system.currentTargetInLineOfFire()) {
      score*=0.9;
    }
    score*=getCharacterBias();
  }
  return score;
}

Fixed version (ground truth):
@Override public double calculateDesirability(Brain brain){
  double score=0;
  TargetingSystem system=brain.getTargetingSystem();
  if (system.hasTarget()) {
    PlayerEntity bot=brain.getEntityOwner();
    final double tweaker=1.0;
    final PlayerEntity enemy=system.getCurrentTarget();
    if (enemy.isOperatingVehicle()) {
      score=1.0;
    }
 else {
      score=tweaker * 1.0 - Evaluators.healthScore(bot) * 1.0 - Evaluators.currentWeaponAmmoScore(bot) * 1.0 - Evaluators.weaponDistanceScore(bot,enemy);
    }
    Vector2f lastSeenAt=system.getLastRemeberedPosition();
    if (lastSeenAt != null) {
    }
    if (!system.currentTargetInLineOfFire()) {
      score*=0.9;
    }
    score*=getCharacterBias();
  }
  return score;
}
Program: 86819
Project: 86819
Buggy source:
/** 
 * Packs and sends out the packet for the peer.
 * @param peer
 */
private void sendPacket(Peer peer){
  if (peer != null) {
    writeBuffer.clear();
    protocol.reset();
    if (this.isServer) {
      long currentTime=System.currentTimeMillis();
      if (currentTime - peer.getLastPingTime() >= config.getPingRate()) {
        peer.setLastPingTime(currentTime);
        peer.send(new PingMessage());
      }
    }
    writeBuffer.position(protocol.size());
    if (peer.isConnecting()) {
      protocol.setPeerId(INVALID_PEER_ID);
    }
 else {
      protocol.setPeerId(peer.getId());
    }
    byte numberOfMessages=0;
    numberOfMessages+=packReliableMessages(writeBuffer,protocol,peer);
    numberOfMessages+=packUnreliableMessages(writeBuffer,protocol,peer);
    protocol.setNumberOfMessages(numberOfMessages);
    if (numberOfMessages > 0) {
      int endPosition=writeBuffer.position();
      writeBuffer.position(0);
{
        protocol.setSendSequence(peer.nextSequenceNumber());
        protocol.setAcknowledge(peer.getRemoteSequence());
        protocol.setAckHistory(peer.getAckHistory());
        protocol.writeTo(writeBuffer);
      }
      writeBuffer.position(endPosition);
      send(writeBuffer,peer);
    }
 else {
      long amountOfTimeSinceLastPacket=System.currentTimeMillis() - peer.getLastSendTime();
      if (amountOfTimeSinceLastPacket >= config.getHeartbeatTime()) {
        peer.send(new HeartbeatMessage());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Packs and sends out the packet for the peer.
 * @param peer
 */
private void sendPacket(Peer peer){
  if (peer != null) {
    writeBuffer.clear();
    protocol.reset();
    if (this.isServer) {
      long currentTime=System.currentTimeMillis();
      if (currentTime - peer.getLastPingTime() >= config.getPingRate()) {
        peer.setLastPingTime(currentTime);
        peer.send(PingMessage.INSTANCE);
      }
    }
    writeBuffer.position(protocol.size());
    if (peer.isConnecting()) {
      protocol.setPeerId(INVALID_PEER_ID);
    }
 else {
      protocol.setPeerId(peer.getId());
    }
    byte numberOfMessages=0;
    numberOfMessages+=packReliableMessages(writeBuffer,protocol,peer);
    numberOfMessages+=packUnreliableMessages(writeBuffer,protocol,peer);
    protocol.setNumberOfMessages(numberOfMessages);
    if (numberOfMessages > 0) {
      int endPosition=writeBuffer.position();
      writeBuffer.position(0);
{
        protocol.setSendSequence(peer.nextSequenceNumber());
        protocol.setAcknowledge(peer.getRemoteSequence());
        protocol.setAckHistory(peer.getAckHistory());
        protocol.writeTo(writeBuffer);
      }
      writeBuffer.position(endPosition);
      send(writeBuffer,peer);
    }
 else {
      long amountOfTimeSinceLastPacket=System.currentTimeMillis() - peer.getLastSendTime();
      if (amountOfTimeSinceLastPacket >= config.getHeartbeatTime()) {
        peer.send(HeartbeatMessage.INSTANCE);
      }
    }
  }
}
Program: 86820
Project: 86820
Buggy source:
/** 
 * Parses the messages
 * @param peer
 * @param buffer
 * @param protocol
 */
private void parseMessages(Peer peer,IOBuffer buffer,Protocol protocol){
  byte numberOfMessages=protocol.getNumberOfMessages();
  while (numberOfMessages > 0 && buffer.position() < buffer.limit()) {
    numberOfMessages--;
    Message message=MessageHeader.readMessageHeader(buffer,messageFactory);
    if (message == null) {
      if (log.enabled()) {
        log.error("String_Node_Str" + receivedAddress);
      }
    }
 else     if (message.isReliable()) {
      if (!peer.isDuplicateMessage(message)) {
        peer.receive(message);
      }
    }
 else {
      if (message instanceof PingMessage) {
        peer.send(new PongMessage());
      }
 else       if (message instanceof PongMessage) {
        peer.pongMessageReceived();
      }
 else {
        peer.receive(message);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Parses the messages
 * @param peer
 * @param buffer
 * @param protocol
 */
private void parseMessages(Peer peer,IOBuffer buffer,Protocol protocol){
  byte numberOfMessages=protocol.getNumberOfMessages();
  while (numberOfMessages > 0 && buffer.position() < buffer.limit()) {
    numberOfMessages--;
    Message message=MessageHeader.readMessageHeader(buffer,messageFactory);
    if (message == null) {
      if (log.enabled()) {
        log.error("String_Node_Str" + receivedAddress);
      }
    }
 else     if (message.isReliable()) {
      if (!peer.isDuplicateMessage(message)) {
        peer.receive(message);
      }
    }
 else {
      if (message instanceof PingMessage) {
        peer.send(PongMessage.INSTANCE);
      }
 else       if (message instanceof PongMessage) {
        peer.pongMessageReceived();
      }
 else {
        peer.receive(message);
      }
    }
  }
}
Program: 86822
Project: 86822
Buggy source:
/** 
 * Reads the buffer to determine what Message to allocate.
 * @param buf
 * @param messageFactory
 * @return the Message;
 */
public static Message readMessageHeader(IOBuffer buf,NetMessageFactory messageFactory){
  Message message=null;
  byte messageType=buf.get();
switch (messageType) {
case CONNECTION_REQUEST_MESSAGE:
{
      message=new ConnectionRequestMessage();
      break;
    }
case CONNECTION_ACCEPTED_MESSAGE:
{
    message=new ConnectionAcceptedMessage();
    break;
  }
case DISCONNECT_MESSAGE:
{
  message=new DisconnectMessage();
  break;
}
case RELIABLE_NETMESSAGE:
{
message=new ReliableNetMessage();
break;
}
case UNRELIABLE_NETMESSAGE:
{
message=new UnReliableNetMessage();
break;
}
case HEARTBEAT_MESSAGE:
{
message=new HeartbeatMessage();
break;
}
case PING_MESSAGE:
{
message=new PingMessage();
break;
}
case PONG_MESSAGE:
{
message=new PongMessage();
break;
}
}
message.readFrom(buf,messageFactory);
return message;
}

Fixed version (ground truth):
/** 
 * Reads the buffer to determine what Message to allocate.
 * @param buf
 * @param messageFactory
 * @return the Message;
 */
public static Message readMessageHeader(IOBuffer buf,NetMessageFactory messageFactory){
  Message message=null;
  byte messageType=buf.get();
switch (messageType) {
case CONNECTION_REQUEST_MESSAGE:
{
      message=new ConnectionRequestMessage();
      break;
    }
case CONNECTION_ACCEPTED_MESSAGE:
{
    message=new ConnectionAcceptedMessage();
    break;
  }
case DISCONNECT_MESSAGE:
{
  message=new DisconnectMessage();
  break;
}
case RELIABLE_NETMESSAGE:
{
message=new ReliableNetMessage();
break;
}
case UNRELIABLE_NETMESSAGE:
{
message=new UnReliableNetMessage();
break;
}
case HEARTBEAT_MESSAGE:
{
message=HeartbeatMessage.INSTANCE;
break;
}
case PING_MESSAGE:
{
message=PingMessage.INSTANCE;
break;
}
case PONG_MESSAGE:
{
message=PongMessage.INSTANCE;
break;
}
}
message.readFrom(buf,messageFactory);
return message;
}
Program: 86823
Project: 86823
Buggy source:
public void addDroppedPacket(){
  this.numberOfDroppedPackets++;
}

Fixed version (ground truth):
public void addDroppedPacket(int numberOfPackets){
  this.numberOfDroppedPackets+=numberOfDroppedPackets;
}
Program: 86824
Project: 86824
Buggy source:
@Override public Message copy(){
  return new HeartbeatMessage();
}

Fixed version (ground truth):
@Override public Message copy(){
  return INSTANCE;
}
Program: 86825
Project: 86825
Buggy source:
@Override public Message copy(){
  return new PingMessage();
}

Fixed version (ground truth):
@Override public Message copy(){
  return INSTANCE;
}
Program: 86826
Project: 86826
Buggy source:
@Override public Message copy(){
  return new PongMessage();
}

Fixed version (ground truth):
@Override public Message copy(){
  return INSTANCE;
}
Program: 86827
Project: 86827
Buggy source:
/** 
 * @param entity
 * @param x
 * @param y
 * @param width
 * @param height
 * @param notIn
 * @return a random position anywhere in the supplied bounds and not in the supplied {@link Rectangle}
 */
public Vector2f getRandomSpotNotIn(Entity entity,int x,int y,int width,int height,Rectangle notIn){
  Vector2f pos=new Vector2f(x + random.nextInt(width),y + random.nextInt(height));
  Rectangle temp=new Rectangle(entity.getBounds());
  temp.setLocation(pos);
  while (map.rectCollides(temp) || notIn.contains(temp)) {
    pos.x=x + random.nextInt(width);
    pos.y=y + random.nextInt(height);
    temp.setLocation(pos);
  }
  return pos;
}

Fixed version (ground truth):
/** 
 * @param entity
 * @param x
 * @param y
 * @param width
 * @param height
 * @param notIn
 * @return a random position anywhere in the supplied bounds and not in the supplied {@link Rectangle}
 */
public Vector2f getRandomSpotNotIn(Entity entity,int x,int y,int width,int height,Rectangle notIn){
  Vector2f pos=new Vector2f(x + random.nextInt(width),y + random.nextInt(height));
  Rectangle temp=new Rectangle(entity.getBounds());
  temp.setLocation(pos);
  while ((map.rectCollides(temp) && !map.hasWorldCollidableTile(temp.x,temp.y)) || notIn.contains(temp)) {
    pos.x=x + random.nextInt(width);
    pos.y=y + random.nextInt(height);
    temp.setLocation(pos);
  }
  return pos;
}