nus-yam/ex-repair huggingface dataset:
Program: 86658
Project: 86658
Buggy source:
@Override public void update(TimeStep timeStep,ParticleData particles){
  ClientEntity ent=emitter.attachedTo();
  if (ent != null) {
    for (int index=0; index < particles.numberOfAliveParticles; index++) {
      Vector2f pos=ent.getCenterPos();
      Vector2f vel=ent.getMovementDir();
      float offset=index;
      Vector2f.Vector2fMS(pos,vel,offset,particles.pos[index]);
      float percentange=(float)index / particles.numberOfAliveParticles;
      particles.color[index].a=0.9512f * (1f - percentange);
    }
  }
 else {
    for (int index=0; index < particles.numberOfAliveParticles; index++) {
      particles.color[index].a=0f;
    }
  }
}

Fixed version (ground truth):
@Override public void update(TimeStep timeStep,ParticleData particles){
  ClientEntity ent=emitter.attachedTo();
  if (ent != null) {
    Vector2f pos=ent.getCenterPos();
    Vector2f vel=ent.getMovementDir();
    for (int index=0; index < particles.numberOfAliveParticles; index++) {
      float offset=index;
      Vector2f.Vector2fMS(pos,vel,offset,particles.pos[index]);
      float percentange=(float)index / particles.numberOfAliveParticles;
      particles.color[index].a=0.9512f * (1f - percentange);
    }
  }
 else {
    for (int index=0; index < particles.numberOfAliveParticles; index++) {
      particles.color[index].a=0f;
    }
  }
}
Program: 86660
Project: 86660
Buggy source:
public void render(Canvas renderer,Camera camera,float alpha){
  if (this.textBox.isVisible()) {
    Rectangle bounds=textBox.getBounds();
    String labelText=textBox.getLabelText();
    renderer.setFont(textBox.getTextLabel().getFont(),(int)textBox.getTextLabel().getTextSize());
    int originalX=bounds.x;
    int originalY=bounds.y;
    renderGradiantBackground(textBox,renderer,camera,alpha);
    if (textBox.hasFocus() || textBox.isHovering()) {
      renderer.drawRect(bounds.x - 1,bounds.y - 1,bounds.width + 2,bounds.height + 2,0x5ff1f401);
    }
    Rectangle lbounds=this.textBox.getTextLabel().getBounds();
    lbounds.set(bounds);
    lbounds.x+=5;
    lbounds.y+=3;
    this.textView.render(renderer,camera,alpha);
    if (showCursor && textBox.hasFocus()) {
      String text=textBox.getText();
      int textWidth=renderer.getWidth(text.substring(0,textBox.getCursorIndex()));
      renderer.setFont(textBox.getTextLabel().getFont(),(int)textBox.getTextLabel().getTextSize());
      RenderFont.drawShadedString(renderer,"String_Node_Str",lbounds.x + textWidth,lbounds.y + renderer.getHeight("String_Node_Str"),textBox.getForegroundColor());
    }
    bounds.x=originalX;
    int width=renderer.getWidth(labelText);
    lbounds=this.textBox.getLabel().getBounds();
    lbounds.set(bounds);
    lbounds.x=bounds.x - (width + 20);
    lbounds.y=originalY + 5;
    this.labelView.render(renderer,camera,alpha);
  }
}

Fixed version (ground truth):
public void render(Canvas renderer,Camera camera,float alpha){
  if (this.textBox.isVisible()) {
    Rectangle bounds=textBox.getBounds();
    String labelText=textBox.getLabelText();
    renderer.setFont(textBox.getTextLabel().getFont(),(int)textBox.getTextLabel().getTextSize());
    int originalX=bounds.x;
    int originalY=bounds.y;
    renderGradiantBackground(textBox,renderer,camera,alpha);
    if (textBox.hasFocus() || textBox.isHovering()) {
      renderer.drawRect(bounds.x - 1,bounds.y - 1,bounds.width + 2,bounds.height + 2,0x5ff1f401);
    }
    Rectangle lbounds=this.textBox.getTextLabel().getBounds();
    lbounds.set(bounds);
    lbounds.x+=5;
    lbounds.y+=3;
    this.textView.render(renderer,camera,alpha);
    if (showCursor && textBox.hasFocus()) {
      String text=textBox.getText();
      int textWidth=renderer.getWidth(text.substring(0,textBox.getCursorIndex())) + 5;
      renderer.setFont(textBox.getTextLabel().getFont(),(int)textBox.getTextLabel().getTextSize());
      RenderFont.drawShadedString(renderer,"String_Node_Str",lbounds.x + textWidth,lbounds.y + renderer.getHeight("String_Node_Str"),textBox.getForegroundColor());
    }
    bounds.x=originalX;
    int width=renderer.getWidth(labelText);
    lbounds=this.textBox.getLabel().getBounds();
    lbounds.set(bounds);
    lbounds.x=bounds.x - (width + 20);
    lbounds.y=originalY + 5;
    this.labelView.render(renderer,camera,alpha);
  }
}
Program: 86662
Project: 86662
Buggy source:
/** 
 * Does multiplex on the Datagram channel
 * @param timeout
 * @return what state the socket is in
 * @throws IOException
 */
private int socketWait(int timeout){
  int result=SOCKET_WAIT;
  int numKeys=0;
  try {
    numKeys=(timeout > 0) ? selector.select(timeout) : selector.selectNow();
  }
 catch (  IOException e) {
    result=SOCKET_ERROR;
  }
  if (numKeys > 0) {
    Iterator<SelectionKey> selectedKeys=selector.selectedKeys().iterator();
    while (selectedKeys.hasNext()) {
      SelectionKey key=selectedKeys.next();
      selectedKeys.remove();
      if (!key.isValid()) {
        continue;
      }
      if (key.isReadable()) {
        result=SOCKET_READ;
        break;
      }
 else       if (key.isWritable()) {
        result=SOCKET_WRITE;
        break;
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Does multiplex on the Datagram channel
 * @param timeout
 * @return what state the socket is in
 * @throws IOException
 */
private int socketWait(int timeout){
  int result=SOCKET_WAIT;
  int numKeys=0;
  try {
    numKeys=(timeout > 0) ? selector.select(timeout) : selector.selectNow();
  }
 catch (  IOException e) {
    if (log.enabled()) {
      log.error("String_Node_Str" + e);
    }
    result=SOCKET_ERROR;
  }
  if (numKeys > 0) {
    Iterator<SelectionKey> selectedKeys=selector.selectedKeys().iterator();
    while (selectedKeys.hasNext()) {
      SelectionKey key=selectedKeys.next();
      selectedKeys.remove();
      if (!key.isValid()) {
        continue;
      }
      if (key.isReadable()) {
        result=SOCKET_READ;
        break;
      }
 else       if (key.isWritable()) {
        result=SOCKET_WRITE;
        break;
      }
    }
  }
  return result;
}
Program: 86663
Project: 86663
Buggy source:
@Override public boolean connect(int timeout,InetSocketAddress address) throws IOException {
  host=new Host(getNetConfig(),null);
  peer=host.connect(address);
  this.connectionId=peer.getId();
  int iteration=timeout / 3;
  while (iteration < timeout * 3) {
    update(iteration);
    if (peer.isConnected()) {
      break;
    }
    iteration+=iteration;
  }
  return peer.isConnected();
}

Fixed version (ground truth):
@Override public boolean connect(int timeout,InetSocketAddress address) throws IOException {
  host=new Host(getNetConfig(),null);
  peer=host.connect(address);
  this.connectionId=peer.getId();
  int attemptsRemaining=5;
  do {
    update(timeout);
  }
 while (!peer.isConnected() && attemptsRemaining-- > 0);
  return peer.isConnected();
}
Program: 86664
Project: 86664
Buggy source:
/** 
 * @param player
 * @return the team strategy for a given player 
 */
private TeamStrategy getStrategyFor(PlayerInfo player){
  if (Team.ALLIED_TEAM_ID == player.getTeamId()) {
    return this.alliedAIStrategy;
  }
 else   if (Team.AXIS_TEAM_ID == player.getTeamId()) {
    return this.axisAIStrategy;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @param player
 * @return the team strategy for a given player 
 */
private TeamStrategy getStrategyFor(PlayerInfo player){
  if (Team.ALLIED_TEAM_ID == player.getTeamId()) {
    return this.alliedAIStrategy;
  }
 else   if (Team.AXIS_TEAM_ID == player.getTeamId()) {
    return this.axisAIStrategy;
  }
  return this.alliedAIStrategy;
}
Program: 86665
Project: 86665
Buggy source:
/** 
 * Connects to a Seventh server
 * @param host
 * @param port
 * @throws IOException
 */
public void connect(String host,int port) throws IOException {
  disconnect();
  InetSocketAddress address=new InetSocketAddress(host,port);
  if (client.connect(12000,address)) {
    client.start();
  }
 else {
    throw new IOException("String_Node_Str" + host + "String_Node_Str"+ port);
  }
}

Fixed version (ground truth):
/** 
 * Connects to a Seventh server
 * @param host
 * @param port
 * @throws IOException
 */
public void connect(String host,int port) throws IOException {
}
Program: 86666
Project: 86666
Buggy source:
/** 
 * Attempts to connect to the server
 */
public void connectToServer(){
}

Fixed version (ground truth):
/** 
 * Attempts to connect to the server
 */
public void connectToServer(){
synchronized (this) {
    if (!isConnecting) {
      isConnecting=true;
      thread=new Thread(new Runnable(){
        @Override public void run(){
          message+=host + "String_Node_Str" + port+ "String_Node_Str";
          try {
            Cons.println("String_Node_Str" + host + "String_Node_Str"+ port);
            connection.disconnect();
            connection.connect(host,port);
            message+="String_Node_Str";
            final ClientProtocol protocol=connection.getClientProtocol();
            Cons.println("String_Node_Str");
            connection.setGameCreationListener(new GameCreationListener(){
              @Override public void onGameCreated(              ClientGame game){
                LoadingScreen.this.game.set(game);
                protocol.sendClientReadyMessage(new ClientReadyMessage());
                isDone.set(true);
              }
            }
);
            ConnectRequestMessage msg=new ConnectRequestMessage();
            msg.name=app.getConfig().getPlayerName();
            protocol.sendConnectRequestMessage(msg);
          }
 catch (          Exception e) {
            Cons.println("String_Node_Str" + e);
            Cons.getImpl().execute("String_Node_Str");
            app.goToMenuScreen();
          }
        }
      }
);
      thread.start();
    }
  }
}
Program: 86668
Project: 86668
Buggy source:
/** 
 * Executes a server frame
 * @param timeStep
 */
private void serverFrame(StateMachine<State> sm,TimeStep timeStep){
  if (!this.isLocal) {
    this.console.update(timeStep);
  }
  sm.update(timeStep);
}

Fixed version (ground truth):
/** 
 * Executes a server frame
 * @param timeStep
 */
private void serverFrame(StateMachine<State> sm,TimeStep timeStep){
  updateConsole(timeStep);
  sm.update(timeStep);
}
Program: 86669
Project: 86669
Buggy source:
@Override public boolean touchUp(int x,int y,int pointer,int button){
  isHandleHeld=false;
  return false;
}

Fixed version (ground truth):
@Override public boolean touchUp(int x,int y,int pointer,int button){
  isHandleHeld=false;
  heldX=0;
  return false;
}
Program: 86670
Project: 86670
Buggy source:
@Override public boolean touchDown(int x,int y,int pointer,int button){
  if (handle.getScreenBounds().contains(x,y)) {
    isHandleHeld=true;
    return true;
  }
 else   if (getScreenBounds().contains(x,y)) {
    moveHandleTo(x);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean touchDown(int x,int y,int pointer,int button){
  if (handle.getScreenBounds().contains(x,y)) {
    isHandleHeld=true;
    heldX=Math.max(x - handle.getBounds().x - getBounds().x,0);
    return true;
  }
 else {
    sliderHitbox.set(getScreenBounds());
    sliderHitbox.height*=4;
    sliderHitbox.y-=(getScreenBounds().height * 2);
    if (sliderHitbox.contains(x,y)) {
      moveHandleTo(x);
      return true;
    }
  }
  return false;
}
Program: 86671
Project: 86671
Buggy source:
private void moveHandleTo(int x){
  int maxX=getBounds().x + getBounds().width;
  int minX=getBounds().x;
  int newIndex=x - minX;
  if (x <= maxX && x >= minX) {
    handle.getBounds().x=newIndex;
  }
  if (newIndex >= 0 && newIndex <= 100) {
    index=newIndex;
    getEventDispatcher().sendNow(event);
  }
}

Fixed version (ground truth):
private void moveHandleTo(int x){
  int maxX=getBounds().x + getBounds().width;
  int minX=getBounds().x;
  int newIndex=(x - minX) - heldX;
  if (x <= maxX && x >= minX) {
    handle.getBounds().x=newIndex;
  }
  if (newIndex >= 0 && newIndex <= MAX_INDEX) {
    index=newIndex;
    getEventDispatcher().sendNow(event);
  }
}
Program: 86672
Project: 86672
Buggy source:
@Override public void update(TimeStep timeStep){
  super.update(timeStep);
  if (lastUpdate > timeStep.getGameClock() - 500) {
    this.isFlagVisible=true;
  }
 else {
    this.isFlagVisible=false;
  }
}

Fixed version (ground truth):
@Override public void update(TimeStep timeStep){
  super.update(timeStep);
  long clockTime=timeStep.getGameClock();
  if (carrier != null && carrier.isAlive()) {
    long lastUpdate=carrier.getEntity().getLastUpdate();
    if ((lastUpdate + 150) < clockTime) {
      fadeAlphaColor=255 - ((int)(clockTime - lastUpdate) / 3);
      if (fadeAlphaColor < 0)       fadeAlphaColor=0;
    }
 else {
      fadeAlphaColor=255;
    }
  }
 else {
    fadeAlphaColor=255;
  }
}
Program: 86673
Project: 86673
Buggy source:
@Override public void render(Canvas canvas,Camera camera,float alpha){
  if (flagImg != null && isFlagVisible) {
    Vector2f cameraPos=camera.getRenderPosition(alpha);
    Vector2f flagPos=pos;
    if (carrier != null && carrier.isAlive()) {
      flagPos=carrier.getEntity().getRenderPos(alpha);
    }
    float x=(flagPos.x - cameraPos.x);
    float y=(flagPos.y - cameraPos.y);
    flagImg.setPosition(x,y);
    canvas.drawSprite(flagImg);
  }
}

Fixed version (ground truth):
@Override public void render(Canvas canvas,Camera camera,float alpha){
  if (flagImg != null) {
    Vector2f cameraPos=camera.getRenderPosition(alpha);
    Vector2f flagPos=pos;
    if (fadeAlphaColor > 0 && carrier != null && carrier.isAlive()) {
      flagPos=carrier.getEntity().getRenderPos(alpha);
    }
    float x=(flagPos.x - cameraPos.x);
    float y=(flagPos.y - cameraPos.y);
    flagImg.setPosition(x,y);
    flagImg.setAlpha(fadeAlphaColor / 255.0f);
    canvas.drawRawSprite(flagImg);
  }
}
Program: 86674
Project: 86674
Buggy source:
@Override public boolean connect(int timeout,InetSocketAddress address) throws IOException {
  host=new Host(getNetConfig(),null);
  peer=host.connect(address);
  this.connectionId=peer.getId();
  update(timeout);
  return peer.isConnected();
}

Fixed version (ground truth):
@Override public boolean connect(int timeout,InetSocketAddress address) throws IOException {
  host=new Host(getNetConfig(),null);
  peer=host.connect(address);
  this.connectionId=peer.getId();
  int iteration=timeout / 3;
  while (iteration < timeout * 3) {
    update(iteration);
    if (peer.isConnected()) {
      break;
    }
    iteration+=iteration;
  }
  return peer.isConnected();
}
Program: 86675
Project: 86675
Buggy source:
/** 
 * Attempts to connect to the server
 */
public void connectToServer(){
synchronized (this) {
    if (!isConnecting) {
      isConnecting=true;
      thread=new Thread(new Runnable(){
        @Override public void run(){
          message+=host + "String_Node_Str" + port+ "String_Node_Str";
          try {
            Cons.println("String_Node_Str" + host + "String_Node_Str"+ port);
            connection.disconnect();
            connection.connect(host,port);
            message+="String_Node_Str";
            final ClientProtocol protocol=connection.getClientProtocol();
            Cons.println("String_Node_Str");
            connection.setGameCreationListener(new GameCreationListener(){
              @Override public void onGameCreated(              ClientGame game){
                LoadingScreen.this.game.set(game);
                protocol.sendClientReadyMessage(new ClientReadyMessage());
                isDone.set(true);
              }
            }
);
            ConnectRequestMessage msg=new ConnectRequestMessage();
            msg.name=app.getConfig().getPlayerName();
            protocol.sendConnectRequestMessage(msg);
          }
 catch (          Exception e) {
            Cons.println("String_Node_Str" + e);
            app.goToMenuScreen();
          }
        }
      }
);
      thread.start();
    }
  }
}

Fixed version (ground truth):
/** 
 * Attempts to connect to the server
 */
public void connectToServer(){
}
Program: 86676
Project: 86676
Buggy source:
/** 
 * Interpolates between the previous and current state sent from the server.
 * @param timeStep
 */
protected void interpolate(TimeStep timeStep){
  if (this.prevState != null && this.nextState != null) {
    float alpha=0.75f;
    float dist=(pos.x - nextState.posX) * (pos.x - nextState.posX) + (pos.y - nextState.posY) * (pos.y - nextState.posY);
    if (dist > 64 * 64) {
      this.pos.x=nextState.posX;
      this.pos.y=nextState.posY;
    }
 else {
      this.pos.x=pos.x + (alpha * (nextState.posX - pos.x));
      this.pos.y=pos.y + (alpha * (nextState.posY - pos.y));
    }
    this.bounds.setLocation(pos);
    this.movementDir.x=nextState.posX - prevState.posX;
    this.movementDir.y=nextState.posY - prevState.posY;
    if (Math.abs(prevState.orientation - nextState.orientation) > (30)) {
      this.orientation=nextState.orientation;
    }
 else {
      this.orientation=prevState.orientation + (alpha * (nextState.orientation - prevState.orientation));
    }
    this.orientation=(float)Math.toRadians(this.orientation);
  }
}

Fixed version (ground truth):
/** 
 * Interpolates between the previous and current state sent from the server.
 * @param timeStep
 */
protected void interpolate(TimeStep timeStep){
  if (this.prevState != null && this.nextState != null) {
    float alpha=0.75f;
    float dist=(pos.x - nextState.posX) * (pos.x - nextState.posX) + (pos.y - nextState.posY) * (pos.y - nextState.posY);
    if (dist > 64 * 64) {
      this.pos.x=nextState.posX;
      this.pos.y=nextState.posY;
      this.previousPos.set(this.pos);
    }
 else {
      this.pos.x=pos.x + (alpha * (nextState.posX - pos.x));
      this.pos.y=pos.y + (alpha * (nextState.posY - pos.y));
    }
    this.bounds.setLocation(pos);
    this.movementDir.x=nextState.posX - prevState.posX;
    this.movementDir.y=nextState.posY - prevState.posY;
    if (Math.abs(prevState.orientation - nextState.orientation) > (30)) {
      this.orientation=nextState.orientation;
    }
 else {
      this.orientation=prevState.orientation + (alpha * (nextState.orientation - prevState.orientation));
    }
    this.orientation=(float)Math.toRadians(this.orientation);
  }
}
Program: 86677
Project: 86677
Buggy source:
public void roundStarted(RoundStartedMessage msg){
  gameEffects.clearEffects();
  this.roundEnded=false;
  scoreboard.setGameEnded(false);
  scoreboard.setWinner(null);
  this.hud.getMessageLog().clearLogs();
  showScoreBoard(false);
  applyFullGameState(msg.gameState);
  executeCallbackScript("String_Node_Str",this);
}

Fixed version (ground truth):
public void roundStarted(RoundStartedMessage msg){
  gameEffects.clearEffects();
  this.roundEnded=false;
  scoreboard.setGameEnded(false);
  scoreboard.setWinner(null);
  this.hud.getMessageLog().clearLogs();
  map.restoreDestroyedTiles();
  showScoreBoard(false);
  applyFullGameState(msg.gameState);
  executeCallbackScript("String_Node_Str",this);
}
Program: 86678
Project: 86678
Buggy source:
@Override public void onRoundStarted(RoundStartedEvent event){
  loadMapScripts();
  aiSystem.startOfRound(Game.this);
}

Fixed version (ground truth):
@Override public void onRoundStarted(RoundStartedEvent event){
  map.restoreDestroyedTiles();
  loadMapScripts();
  aiSystem.startOfRound(Game.this);
}
Program: 86680
Project: 86680
Buggy source:
/** 
 * @param image
 * @param width
 * @param height
 */
public AnimatedTile(AnimatedImage image,int width,int height){
  super(null,width,height);
  this.image=image;
  this.image.loop(true);
}

Fixed version (ground truth):
/** 
 * @param image
 * @param width
 * @param height
 */
public AnimatedTile(AnimatedImage image,int layer,int width,int height){
  super(null,layer,width,height);
  this.image=image;
  this.image.loop(true);
}
Program: 86682
Project: 86682
Buggy source:
/** 
 */
public Tile(TextureRegion image,int width,int height){
  this.width=width;
  this.height=height;
  this.bounds=new Rectangle();
  this.collisionMask=CollisionMask.NO_COLLISION;
  this.surfaceType=SurfaceType.CEMENT;
  this.isDestroyed=false;
  if (image != null) {
    this.sprite=new Sprite(image);
  }
}

Fixed version (ground truth):
/** 
 */
public Tile(TextureRegion image,int layer,int width,int height){
  this.layer=layer;
  this.width=width;
  this.height=height;
  this.bounds=new Rectangle();
  this.collisionMask=CollisionMask.NO_COLLISION;
  this.surfaceType=SurfaceType.CEMENT;
  this.isDestroyed=false;
  if (image != null) {
    this.sprite=new Sprite(image);
  }
}
Program: 86684
Project: 86684
Buggy source:
/** 
 * Finds the closest friendly bot
 * @param game
 * @return the id of the closest bot, or -1 if no bots are available.
 */
protected int findClosestBot(ClientGame game,ClientPlayer otherPlayer){
  ClientPlayers players=game.getPlayers();
  if (!otherPlayer.isAlive()) {
    return -1;
  }
  ClientTeam team=otherPlayer.getTeam();
  int closestBot=-1;
  float closestDistance=-1f;
  for (int i=0; i < players.getMaxNumberOfPlayers(); i++) {
    ClientPlayer player=players.getPlayer(i);
    if (player != null && player.isAlive() && player.isBot()) {
      if (player.getTeam().equals(team)) {
        Vector2f pos=otherPlayer.getEntity().getPos();
        Vector2f botPos=player.getEntity().getPos();
        float dist=Vector2f.Vector2fDistanceSq(pos,botPos);
        if (closestBot == -1 || dist < closestDistance) {
          closestBot=i;
          closestDistance=dist;
        }
      }
    }
  }
  return closestBot;
}

Fixed version (ground truth):
/** 
 * Finds the closest friendly bot
 * @param game
 * @return the id of the closest bot, or -1 if no bots are available.
 */
protected int findClosestBot(ClientGame game,ClientPlayer otherPlayer){
  ClientPlayers players=game.getPlayers();
  if (!otherPlayer.isAlive()) {
    return -1;
  }
  ClientTeam team=otherPlayer.getTeam();
  int closestBot=-1;
  float closestDistance=-1f;
  for (int i=0; i < players.getMaxNumberOfPlayers(); i++) {
    ClientPlayer player=players.getPlayer(i);
    if (player != null && otherPlayer != player && player.isAlive() && player.isBot()) {
      if (player.getTeam().equals(team)) {
        Vector2f pos=otherPlayer.getEntity().getPos();
        Vector2f botPos=player.getEntity().getPos();
        float dist=Vector2f.Vector2fDistanceSq(pos,botPos);
        if (closestBot == -1 || dist < closestDistance) {
          closestBot=i;
          closestDistance=dist;
        }
      }
    }
  }
  return closestBot;
}
Program: 86685
Project: 86685
Buggy source:
/** 
 * @param pos
 * @param vel
 */
public BloodParticle(Vector2f pos,Vector2f vel,int angle,float scale,int timeToLive){
  super(pos,vel,timeToLive);
  this.speed=10;
  this.angle=(float)angle;
  this.image=Art.randomBloodspat();
  this.sprite=new Sprite(image);
  this.sprite.setScale(scale);
  this.sprite.flip(false,true);
  this.alphaFade=new FadeValue(255,0,timeToLive + 1000);
}

Fixed version (ground truth):
/** 
 * @param pos
 * @param vel
 */
public BloodParticle(Vector2f pos,Vector2f vel,int angle,float scale,int timeToLive){
  super(pos,vel,timeToLive);
  this.scale=scale;
  this.speed=10;
  this.angle=(float)angle;
  this.image=Art.randomBloodspat();
  this.sprite=new Sprite(image);
  this.sprite.setScale(scale);
  this.sprite.flip(false,true);
  this.alphaFade=new FadeValue(255,0,timeToLive + 1000);
}
Program: 86686
Project: 86686
Buggy source:
public void removeTile(TileRemovedMessage msg){
  map.removeDestructableTileAt(msg.x,msg.y);
}

Fixed version (ground truth):
public void removeTile(TileRemovedMessage msg){
  Tile tile=map.getDestructableTile(msg.x,msg.y);
  if (tile != null) {
    this.gameEffects.addBackgroundEffect(new WallCrumbleEmitter(tile,new Vector2f(tile.getX(),tile.getY())));
  }
  map.removeDestructableTileAt(msg.x,msg.y);
}
Program: 86687
Project: 86687
Buggy source:
/** 
 * @param pos
 * @param timeToLive
 * @param timeToNextSpawn
 */
public WallCrumbleEmitter(TextureRegion image,Vector2f pos){
}

Fixed version (ground truth):
/** 
 * @param pos
 * @param timeToLive
 * @param timeToNextSpawn
 */
public WallCrumbleEmitter(Tile tile,Vector2f pos){
}
Program: 86688
Project: 86688
Buggy source:
public void setFlips(boolean isFlippedHorizontal,boolean isFlippedVert,boolean isFlippedDiagnally){
  if (this.sprite == null)   return;
  if (isFlippedDiagnally) {
    if (isFlippedHorizontal && isFlippedVert) {
      this.sprite.flip(true,false);
      this.sprite.rotate(-270f);
    }
 else     if (isFlippedHorizontal) {
      this.sprite.rotate(-270f);
    }
 else     if (isFlippedVert) {
      this.sprite.rotate(-90f);
    }
 else {
      this.sprite.flip(false,true);
      this.sprite.rotate(-270f);
    }
  }
 else {
    this.sprite.flip(isFlippedHorizontal,isFlippedVert);
  }
}

Fixed version (ground truth):
public void setFlips(boolean isFlippedHorizontal,boolean isFlippedVert,boolean isFlippedDiagnally){
  if (isFlippedDiagnally)   this.flipMask|=Tile.isFlippedDiagnally;
  if (isFlippedHorizontal)   this.flipMask|=Tile.isFlippedHorizontal;
  if (isFlippedVert)   this.flipMask|=Tile.isFlippedVert;
  if (this.sprite == null)   return;
  TextureUtil.setFlips(this.sprite,isFlippedHorizontal,isFlippedVert,isFlippedDiagnally);
}
Program: 86689
Project: 86689
Buggy source:
/** 
 */
public Tile(TextureRegion image,int width,int height){
  this.image=image;
  this.width=width;
  this.height=height;
  this.bounds=new Rectangle();
  this.collisionMask=CollisionMask.NO_COLLISION;
  this.surfaceType=SurfaceType.CEMENT;
  this.isDestroyed=false;
  if (image != null) {
    this.sprite=new Sprite(image);
  }
}

Fixed version (ground truth):
/** 
 */
public Tile(TextureRegion image,int width,int height){
  this.width=width;
  this.height=height;
  this.bounds=new Rectangle();
  this.collisionMask=CollisionMask.NO_COLLISION;
  this.surfaceType=SurfaceType.CEMENT;
  this.isDestroyed=false;
  if (image != null) {
    this.sprite=new Sprite(image);
  }
}
Program: 86690
Project: 86690
Buggy source:
/** 
 * @return the image
 */
public TextureRegion getImage(){
  return image;
}

Fixed version (ground truth):
/** 
 * @return the image
 */
public Sprite getImage(){
  return this.sprite;
}
Program: 86691
Project: 86691
Buggy source:
/** 
 * Applies the remote   {@link PlayerInputMessage} to the {@link PlayerEntity}
 * @param playerId
 * @param msg
 */
public void applyPlayerInput(int playerId,PlayerInputMessage 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;
    }
  }
}

Fixed version (ground truth):
/** 
 * Applies the remote   {@link PlayerInputMessage} to the {@link PlayerEntity}
 * @param playerId
 * @param msg
 */
public void applyPlayerInput(int playerId,PlayerInputMessage msg){
  Player player=this.players.getPlayer(playerId);
  if (player != null) {
    if (player.isAlive()) {
      PlayerEntity entity=player.getEntity();
      entity.handleUserCommand(msg.keys,msg.orientation);
    }
 else {
      player.handleInput(this,msg.keys);
    }
  }
}
Program: 86692
Project: 86692
Buggy source:
/** 
 * @param game
 * @param player
 * @param pos
 */
public ClientPlayerEntity(ClientGame game,ClientPlayer player,Vector2f pos){
  super(game,pos);
  this.type=Type.PLAYER;
  this.currentState=State.IDLE;
  this.invinceableTime=0;
  this.lineOfSight=WeaponConstants.DEFAULT_LINE_OF_SIGHT;
  this.bloodEmitter=game.getGameEffects().getBloodEmitterForPlayer(player.getId());
  this.bloodEmitter.pause();
  this.bounds.width=24;
  this.bounds.height=24;
  LightSystem lightSystem=game.getLightSystem();
  this.mussleFlash=lightSystem.newPointLight();
  this.mussleFlash.setTexture(Art.fireWeaponLight);
  this.mussleFlash.setColor(0.5f,0.5f,0.5f);
  setPlayer(player);
}

Fixed version (ground truth):
/** 
 * @param game
 * @param player
 * @param pos
 */
public ClientPlayerEntity(ClientGame game,ClientPlayer player,Vector2f pos){
  super(game,pos);
  this.type=Type.PLAYER;
  this.currentState=State.IDLE;
  this.invinceableTime=0;
  this.lineOfSight=WeaponConstants.DEFAULT_LINE_OF_SIGHT;
  this.bloodEmitter=game.getGameEffects().getBloodEmitterForPlayer(player.getId());
  this.bloodEmitter.pause();
  this.bounds.width=24;
  this.bounds.height=24;
  LightSystem lightSystem=game.getLightSystem();
  this.mussleFlash=lightSystem.newPointLight();
  this.mussleFlash.setTexture(Art.fireWeaponLight);
  this.mussleFlash.setColor(0.5f,0.5f,0.5f);
  ClientPlayer localPlayer=game.getLocalPlayer();
  if (localPlayer != null) {
    setControlledByLocalPlayer(localPlayer.getId() == player.getId());
  }
  setPlayer(player);
}
Program: 86693
Project: 86693
Buggy source:
/** 
 * Destroys this shader
 */
public void destroy(){
  getShader().dispose();
}

Fixed version (ground truth):
/** 
 * Destroys this shader
 */
public void destroy(){
  try {
    getShader().dispose();
  }
 catch (  Exception ignore) {
  }
}
Program: 86694
Project: 86694
Buggy source:
@Override public void update(Brain brain,TimeStep timeStep){
  this.updateEval.update(timeStep);
  if (this.updateEval.isTime()) {
    ActionEvaluator newEvaluator=Evaluators.evaluate(brain,evaluators);
    if (this.currentActiveEvaluator == null || this.isFinished(brain) || newEvaluator.isRepeatable() || ((newEvaluator.getKeepBias() > this.currentActiveEvaluator.getKeepBias()) && (newEvaluator != this.currentActiveEvaluator))) {
      Action action=newEvaluator.getAction(brain);
      if (action != null && this.currentAction != action) {
        this.currentActiveEvaluator=newEvaluator;
        if (this.currentActiveEvaluator.isContinuable()) {
          interrupt(brain);
          addFirstAction(action);
        }
 else {
          this.replace(action);
        }
        if (newEvaluator.isRepeatable()) {
          action.start(brain);
        }
        this.currentAction=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=Evaluators.evaluate(brain,evaluators);
    boolean isFinished=isFinished(brain);
    if (this.currentActiveEvaluator == null || isFinished || newEvaluator.isRepeatable() || ((newEvaluator.getKeepBias() > this.currentActiveEvaluator.getKeepBias()) && (newEvaluator != this.currentActiveEvaluator))) {
      Action action=newEvaluator.getAction(brain);
      if (action != null && (isFinished || this.currentAction != action)) {
        this.currentActiveEvaluator=newEvaluator;
        if (this.currentActiveEvaluator.isContinuable()) {
          interrupt(brain);
          addFirstAction(action);
        }
 else {
          this.replace(action);
        }
        if (newEvaluator.isRepeatable()) {
          action.start(brain);
        }
        this.currentAction=action;
      }
    }
  }
  super.update(brain,timeStep);
}
Program: 86695
Project: 86695
Buggy source:
@Override public boolean isInProgress(GameInfo game){
  return target != null && target.bombActive();
}

Fixed version (ground truth):
@Override public boolean isInProgress(GameInfo game){
  return target != null && (target.bombActive() || target.isBeingDestroyed());
}
Program: 86696
Project: 86696
Buggy source:
@Override protected GameState doUpdate(Game game,TimeStep timeStep){
  if (this.inIntermission) {
    this.currentDelayTime-=timeStep.getDeltaTime();
    if (this.currentDelayTime <= 0) {
      startRound(game);
    }
  }
 else {
    int numberOfObjectivesInProgress=0;
    int size=this.outstandingObjectives.size();
    for (int i=0; i < size; i++) {
      Objective obj=this.outstandingObjectives.get(i);
      if (obj.isCompleted(game)) {
        this.completedObjectives.add(obj);
      }
 else       if (obj.isInProgress(game)) {
        numberOfObjectivesInProgress++;
      }
    }
    this.outstandingObjectives.removeAll(this.completedObjectives);
    if (this.completedObjectives.size() >= this.minimumObjectivesToComplete) {
      endRound(attacker,game);
    }
 else     if (this.outstandingObjectives.isEmpty() && this.completedObjectives.size() > 0) {
      endRound(attacker,game);
    }
 else     if (defender.isTeamDead() && defender.teamSize() > 0) {
      endRound(attacker,game);
    }
 else     if (getRemainingTime() <= 0) {
      endRound(defender,game);
    }
 else     if (attacker.isTeamDead() && attacker.teamSize() > 0 && (!this.outstandingObjectives.isEmpty() ? numberOfObjectivesInProgress < this.outstandingObjectives.size() : true)) {
      endRound(defender,game);
    }
 else {
      checkSpectating(timeStep,game);
    }
  }
  return this.currentRound >= this.getMaxScore() ? GameState.WINNER : GameState.IN_PROGRESS;
}

Fixed version (ground truth):
@Override protected GameState doUpdate(Game game,TimeStep timeStep){
  if (this.inIntermission) {
    this.currentDelayTime-=timeStep.getDeltaTime();
    if (this.currentDelayTime <= 0) {
      startRound(game);
    }
  }
 else {
    int numberOfObjectivesInProgress=0;
    int size=this.outstandingObjectives.size();
    for (int i=0; i < size; i++) {
      Objective obj=this.outstandingObjectives.get(i);
      if (obj.isCompleted(game)) {
        this.completedObjectives.add(obj);
      }
 else       if (obj.isInProgress(game)) {
        numberOfObjectivesInProgress++;
      }
    }
    this.outstandingObjectives.removeAll(this.completedObjectives);
    if (this.completedObjectives.size() >= this.minimumObjectivesToComplete) {
      endRound(attacker,game);
    }
 else     if (this.outstandingObjectives.isEmpty() && this.completedObjectives.size() > 0) {
      endRound(attacker,game);
    }
 else     if (defender.isTeamDead() && defender.teamSize() > 0) {
      endRound(attacker,game);
    }
 else     if (getRemainingTime() <= 0) {
      endRound(defender,game);
    }
 else     if ((attacker.isTeamDead() && attacker.teamSize() > 0) && (numberOfObjectivesInProgress + this.completedObjectives.size() < this.minimumObjectivesToComplete)) {
      endRound(defender,game);
    }
 else {
      checkSpectating(timeStep,game);
    }
  }
  return this.currentRound >= this.getMaxScore() ? GameState.WINNER : GameState.IN_PROGRESS;
}
Program: 86697
Project: 86697
Buggy source:
public void playerSpawned(PlayerSpawnedMessage msg){
  ClientPlayer player=players.getPlayer(msg.playerId);
  if (player != null) {
    Vector2f spawnLocation=new Vector2f(msg.posX,msg.posY);
    removeEntity(msg.playerId);
    ClientPlayerEntity entity=new ClientPlayerEntity(this,player,spawnLocation);
    entity.spawned();
    if (localPlayer != null) {
      if (player == localPlayer) {
        entity.setControlledByLocalPlayer(true);
        camera.centerAroundNow(spawnLocation);
      }
 else       if (localPlayer.getSpectatingPlayerId() == player.getId()) {
        camera.centerAroundNow(spawnLocation);
      }
    }
    entities.addEntity(msg.playerId,entity);
    entityListener.onEntityCreated(entity);
    Sounds.startPlaySound(Sounds.respawnSnd,msg.playerId,spawnLocation.x,spawnLocation.y);
  }
}

Fixed version (ground truth):
public void playerSpawned(PlayerSpawnedMessage msg){
  ClientPlayer player=players.getPlayer(msg.playerId);
  if (player != null) {
    Vector2f spawnLocation=new Vector2f(msg.posX,msg.posY);
    removeEntity(msg.playerId);
    ClientPlayerEntity entity=new ClientPlayerEntity(this,player,spawnLocation);
    entity.spawned();
    if (localPlayer != null) {
      if (player.getId() == localPlayer.getId() || localPlayer.getSpectatingPlayerId() == player.getId()) {
        camera.centerAroundNow(spawnLocation);
      }
    }
    entities.addEntity(msg.playerId,entity);
    entityListener.onEntityCreated(entity);
    Sounds.startPlaySound(Sounds.respawnSnd,msg.playerId,spawnLocation.x,spawnLocation.y);
  }
}
Program: 86698
Project: 86698
Buggy source:
/** 
 * @param owner the owner to set
 */
public void setOwner(Entity owner){
  this.owner=owner;
}

Fixed version (ground truth):
/** 
 * @param owner the owner to set
 */
public void setOwner(Entity owner){
  this.owner=owner;
  this.gunSwing.setOwner(owner);
}
Program: 86699
Project: 86699
Buggy source:
@Override public void render(Canvas canvas,Camera camera,float alpha){
  if (flagImg != null) {
    Vector2f cameraPos=camera.getRenderPosition(alpha);
    Vector2f flagPos=pos;
    if (carrier != null) {
      flagPos=carrier.getEntity().getRenderPos(alpha);
    }
    float x=(flagPos.x - cameraPos.x);
    float y=(flagPos.y - cameraPos.y);
    flagImg.setPosition(x,y);
    canvas.drawSprite(flagImg);
  }
}

Fixed version (ground truth):
@Override public void render(Canvas canvas,Camera camera,float alpha){
  if (flagImg != null) {
    Vector2f cameraPos=camera.getRenderPosition(alpha);
    Vector2f flagPos=pos;
    if (carrier != null && carrier.isAlive()) {
      flagPos=carrier.getEntity().getRenderPos(alpha);
    }
    float x=(flagPos.x - cameraPos.x);
    float y=(flagPos.y - cameraPos.y);
    flagImg.setPosition(x,y);
    canvas.drawSprite(flagImg);
  }
}
Program: 86701
Project: 86701
Buggy source:
public void play(float x,float y,boolean loop){
  SoundSystemConfig.setDefaultFadeDistance(10000f);
  this.soundSystem.quickPlay(true,soundFile,loop,x,y,0,SoundSystemConfig.ATTENUATION_NONE,10.0f);
}

Fixed version (ground truth):
public void play(float x,float y,boolean loop){
  this.soundSystem.setPosition(sourceName,x,y,0);
  this.soundSystem.setLooping(sourceName,loop);
  this.soundSystem.play(sourceName);
}
Program: 86702
Project: 86702
Buggy source:
public boolean isPlaying(){
  return this.soundSystem.playing(soundFile);
}

Fixed version (ground truth):
public boolean isPlaying(){
  return this.soundSystem.playing(sourceName);
}
Program: 86703
Project: 86703
Buggy source:
public float getVolume(){
  return this.soundSystem.getVolume(soundFile);
}

Fixed version (ground truth):
public float getVolume(){
  return this.soundSystem.getVolume(sourceName);
}
Program: 86704
Project: 86704
Buggy source:
public void stop(){
  this.soundSystem.stop(soundFile);
}

Fixed version (ground truth):
public void stop(){
  this.soundSystem.stop(sourceName);
}
Program: 86705
Project: 86705
Buggy source:
public void reset(){
  this.soundSystem.rewind(soundFile);
}

Fixed version (ground truth):
public void reset(){
  this.soundSystem.rewind(sourceName);
}
Program: 86706
Project: 86706
Buggy source:
public void destroy(){
  this.soundSystem.unloadSound(soundFile);
}

Fixed version (ground truth):
public void destroy(){
  this.soundSystem.removeSource(sourceName);
}
Program: 86707
Project: 86707
Buggy source:
/** 
 * @param soundFile
 * @param soundSystem
 */
public Sound(String soundFile,SoundSystem soundSystem) throws Exception {
  super();
  this.soundFile=soundFile;
  this.soundSystem=soundSystem;
  this.soundSystem.loadSound(new File(soundFile).toURI().toURL(),soundFile);
}

Fixed version (ground truth):
/** 
 * @param soundFile
 * @param soundSystem
 */
public Sound(SoundSystem soundSystem,String soundFile,String soundName) throws Exception {
  this.soundSystem=soundSystem;
  this.sourceName=soundName;
  this.soundSystem.newSource(true,this.sourceName,soundFile,false,0,0,0,SoundSystemConfig.ATTENUATION_ROLLOFF,SoundSystemConfig.getDefaultRolloff());
}
Program: 86708
Project: 86708
Buggy source:
public void setVolume(float v){
  this.soundSystem.setVolume(soundFile,v);
}

Fixed version (ground truth):
public void setVolume(float v){
  this.soundSystem.setVolume(sourceName,v);
}
Program: 86709
Project: 86709
Buggy source:
public void pause(){
  this.soundSystem.pause(soundFile);
}

Fixed version (ground truth):
public void pause(){
  this.soundSystem.pause(sourceName);
}
Program: 86710
Project: 86710
Buggy source:
public static void init(ClientSeventhConfig cfg){
  try {
    Cons.println("String_Node_Str");
    Cons.getImpl().addCommand(getVolumeCommand());
    config=cfg;
    volume=config.getVolume();
    SoundSystemConfig.setMasterGain(volume);
    SoundSystemConfig.setLogger(new SoundSystemLogger(){
      @Override public void errorMessage(      String message,      String error,      int code){
        Cons.println("String_Node_Str" + message + "String_Node_Str"+ error+ "String_Node_Str"+ code);
      }
      @Override public void message(      String message,      int code){
        Cons.println("String_Node_Str" + message + "String_Node_Str"+ code);
      }
      @Override public void importantMessage(      String message,      int code){
        Cons.println("String_Node_Str" + message + "String_Node_Str"+ code);
      }
    }
);
    SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
    SoundSystemConfig.setCodec("String_Node_Str",CodecWav.class);
    soundSystem=new SoundSystem(LibraryLWJGLOpenAL.class);
    setVolume(volume);
    for (int i=0; i < channels.length; i++) {
      channels[i]=createChannel();
    }
    Cons.println("String_Node_Str");
  }
 catch (  SoundSystemException e) {
    Cons.println("String_Node_Str");
  }
}

Fixed version (ground truth):
public static void init(ClientSeventhConfig cfg){
  try {
    Cons.println("String_Node_Str");
    Cons.getImpl().addCommand(getVolumeCommand());
    config=cfg;
    volume=config.getVolume();
    SoundSystemConfig.setMasterGain(volume);
    SoundSystemConfig.setLogger(new SoundSystemLogger(){
      @Override public void errorMessage(      String message,      String error,      int code){
        Cons.println("String_Node_Str" + message + "String_Node_Str"+ error+ "String_Node_Str"+ code);
      }
      @Override public void message(      String message,      int code){
        Cons.println("String_Node_Str" + message + "String_Node_Str"+ code);
      }
      @Override public void importantMessage(      String message,      int code){
        Cons.println("String_Node_Str" + message + "String_Node_Str"+ code);
      }
    }
);
    SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
    SoundSystemConfig.setCodec("String_Node_Str",CodecWav.class);
    SoundSystemConfig.setDefaultFadeDistance(10000f);
    soundSystem=new SoundSystem(LibraryLWJGLOpenAL.class);
    setVolume(volume);
    for (int i=0; i < channels.length; i++) {
      channels[i]=createChannel();
    }
    Cons.println("String_Node_Str");
  }
 catch (  SoundSystemException e) {
    Cons.println("String_Node_Str");
  }
}
Program: 86711
Project: 86711
Buggy source:
/** 
 * Attempts to load a   {@link Sound}
 * @param soundFile
 * @return the {@link Sound} if loaded successfully
 */
public static synchronized Sound loadSound(String soundFile){
  try {
    if (loadedSounds.containsKey(soundFile)) {
      return loadedSounds.get(soundFile);
    }
    Sound sound=new Sound(soundFile,soundSystem);
    loadedSounds.put(soundFile,sound);
    return sound;
  }
 catch (  Exception e) {
    Cons.println("String_Node_Str" + soundFile + "String_Node_Str"+ e);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Attempts to load a   {@link Sound}
 * @param soundFile
 * @return the {@link Sound} if loaded successfully
 */
public static synchronized Sound loadSound(String soundFile){
  try {
    Sound sound=null;
    if (loadedSounds.containsKey(soundFile)) {
      sound=loadedSounds.get(soundFile).newSound();
    }
 else {
      SoundBuffer buffer=new SoundBuffer(soundSystem,soundFile,random);
      loadedSounds.put(soundFile,buffer);
      sound=buffer.newSound();
    }
    sound.setVolume(volume);
    return sound;
  }
 catch (  Exception e) {
    Cons.println("String_Node_Str" + soundFile + "String_Node_Str"+ e);
  }
  return null;
}
Program: 86712
Project: 86712
Buggy source:
public static synchronized void destroy(){
  if (soundSystem != null) {
    for (    Sound sound : loadedSounds.values()) {
      sound.destroy();
    }
    loadedSounds.clear();
    soundSystem.removeTemporarySources();
    try {
      Thread.sleep(500);
    }
 catch (    InterruptedException e) {
    }
    try {
      soundSystem.cleanup();
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
public static synchronized void destroy(){
  if (soundSystem != null) {
    for (    SoundBuffer sound : loadedSounds.values()) {
      sound.destroy();
    }
    loadedSounds.clear();
    soundSystem.removeTemporarySources();
    try {
      Thread.sleep(500);
    }
 catch (    InterruptedException e) {
    }
    try {
      soundSystem.cleanup();
    }
 catch (    Exception e) {
    }
  }
}
Program: 86715
Project: 86715
Buggy source:
/** 
 * Plays the sound right next to the sound listener so it is always audible.
 * @param soundBank
 * @return the {@link Sound}
 */
public static Sound playGlobalSound(int[] soundBank){
  float x=0;
  float y=0;
  if (soundSystem != null) {
    ListenerData data=soundSystem.getListenerData();
    x=data.position.x;
    y=data.position.y;
  }
  return playSound(soundBank,uiChannel,x,y);
}

Fixed version (ground truth):
/** 
 * Plays the sound right next to the sound listener so it is always audible.
 * @param soundBank
 * @return the {@link Sound}
 */
public static Sound playGlobalSound(int[] soundBank){
  float x=0;
  float y=0;
  if (soundSystem != null) {
    ListenerData data=soundSystem.getListenerData();
    x=data.position.x;
    y=data.position.y;
  }
  return playFreeSound(soundBank,x,y);
}
Program: 86716
Project: 86716
Buggy source:
public static Sound playFreeSound(int[] soundBank,float x,float y){
  int index=random.nextInt(soundBank.length);
  int soundIndex=soundBank[index];
  Sound snd=findFreeSound(soundIndex);
  if (snd != null) {
    snd.reset();
    snd.setVolume(volume);
    snd.play(x,y);
  }
  return snd;
}

Fixed version (ground truth):
public static Sound playFreeSound(int[] soundBank,float x,float y,float damp){
  int index=random.nextInt(soundBank.length);
  int soundIndex=soundBank[index];
  Sound snd=findFreeSound(soundIndex);
  if (snd != null) {
    snd.setVolume(volume * damp);
    snd.play(x,y);
  }
  return snd;
}
Program: 86717
Project: 86717
Buggy source:
public static Sound findFreeSound(int soundIndex){
  for (int i=0; i < channels.length; i++) {
    Sound[] sounds=channels[i];
    Sound sound=sounds[soundIndex];
    if (!sound.isPlaying())     return sound;
  }
  return null;
}

Fixed version (ground truth):
public static Sound findFreeSound(int soundIndex){
  for (int i=0; i < channels.length; i++) {
    Sound[] sounds=channels[i];
    Sound sound=sounds[soundIndex];
    if (!sound.isPlaying()) {
      return sound;
    }
  }
  System.out.println("String_Node_Str");
  return null;
}
Program: 86718
Project: 86718
Buggy source:
/** 
 * @param position
 */
public SquadAttackAction(Vector2f position){
  this.attackPosition=position;
}

Fixed version (ground truth):
/** 
 * @param position
 */
public SquadAttackAction(Vector2f position){
  this.attackPosition=position;
  this.attackDirections=new ArrayList<>();
}
Program: 86719
Project: 86719
Buggy source:
@Override public void start(Squad squad){
  World world=squad.getWorld();
  this.attackDirections=world.getAttackDirections(attackPosition,150f,squad.squadSize());
  if (attackDirections.isEmpty()) {
    attackDirections.add(new AttackDirection(attackPosition));
  }
}

Fixed version (ground truth):
@Override public void start(Squad squad){
  World world=squad.getWorld();
  this.attackDirections.addAll(world.getAttackDirections(attackPosition,150f,squad.squadSize()));
  if (attackDirections.isEmpty()) {
    attackDirections.add(new AttackDirection(attackPosition));
  }
}
Program: 86720
Project: 86720
Buggy source:
/** 
 * @param position
 */
public SquadDefendAction(Vector2f position){
  this.defendPosition=position;
}

Fixed version (ground truth):
/** 
 * @param position
 */
public SquadDefendAction(Vector2f position){
  this.defendPosition=position;
  this.directionsToDefend=new ArrayList<>();
}
Program: 86721
Project: 86721
Buggy source:
@Override public void start(Squad squad){
  World world=squad.getWorld();
  float radius=(float)world.getRandom().getRandomRange(100f,150f);
  directionsToDefend=world.getAttackDirections(this.defendPosition,radius,12);
}

Fixed version (ground truth):
@Override public void start(Squad squad){
  World world=squad.getWorld();
  float radius=(float)world.getRandom().getRandomRange(100f,150f);
  directionsToDefend.addAll(world.getAttackDirections(this.defendPosition,radius,12));
}