nus-yam/ex-repair huggingface dataset:
Program: 164197
Project: 164197
Buggy source:
public static String titleCase(String str){
  if (lang == Languages.ENGLISH) {
    String result="String_Node_Str";
    for (    String word : str.split("String_Node_Str")) {
      if (noCaps.contains(word.trim().toLowerCase().replaceAll("String_Node_Str","String_Node_Str"))) {
        result+=word;
      }
 else {
        result+=capitalize(word);
      }
    }
    return capitalize(result);
  }
  return capitalize(str);
}

Fixed version (ground truth):
public static String titleCase(String str){
  if (lang == Languages.ENGLISH) {
    String result="String_Node_Str";
    for (    String word : str.split("String_Node_Str")) {
      if (noCaps.contains(word.trim().toLowerCase(Locale.ENGLISH).replaceAll("String_Node_Str","String_Node_Str"))) {
        result+=word;
      }
 else {
        result+=capitalize(word);
      }
    }
    return capitalize(result);
  }
  return capitalize(str);
}
Program: 164198
Project: 164198
Buggy source:
public static String get(Class c,String k,Object... args){
  String key;
  if (c != null) {
    key=c.getName().replace("String_Node_Str","String_Node_Str");
    key+="String_Node_Str" + k;
  }
 else   key=k;
  if (!strings.containsKey(key.toLowerCase())) {
    if (c != null && c.getSuperclass() != null) {
      return get(c.getSuperclass(),k,args);
    }
 else {
      return "String_Node_Str";
    }
  }
 else {
    if (args.length > 0)     return format(strings.get(key.toLowerCase()),args);
 else     return strings.get(key.toLowerCase());
  }
}

Fixed version (ground truth):
public static String get(Class c,String k,Object... args){
  String key;
  if (c != null) {
    key=c.getName().replace("String_Node_Str","String_Node_Str");
    key+="String_Node_Str" + k;
  }
 else   key=k;
  if (strings.containsKey(key.toLowerCase(Locale.ENGLISH))) {
    if (c != null && c.getSuperclass() != null) {
      return get(c.getSuperclass(),k,args);
    }
 else {
      return "String_Node_Str";
    }
  }
 else {
    if (args.length > 0)     return format(strings.get(key.toLowerCase(Locale.ENGLISH)),args);
 else     return strings.get(key.toLowerCase(Locale.ENGLISH));
  }
}
Program: 164199
Project: 164199
Buggy source:
public void burn(){
  if (type == Type.MIMIC) {
    Mimic m=Mimic.spawnAt(pos,items);
    if (m != null) {
      Buff.affect(m,Burning.class).reignite(m);
      m.sprite.emitter().burst(FlameParticle.FACTORY,5);
      destroy();
    }
  }
  if (type != Type.HEAP) {
    return;
  }
  boolean burnt=false;
  boolean evaporated=false;
  for (  Item item : items.toArray(new Item[0])) {
    if (item instanceof Scroll) {
      items.remove(item);
      burnt=true;
    }
 else     if (item instanceof Dewdrop) {
      items.remove(item);
      evaporated=true;
    }
 else     if (item instanceof MysteryMeat) {
      replace(item,ChargrilledMeat.cook((MysteryMeat)item));
      burnt=true;
    }
 else     if (item instanceof Bomb) {
      items.remove(item);
      ((Bomb)item).explode(pos);
      return;
    }
  }
  if (burnt || evaporated) {
    if (Dungeon.visible[pos]) {
      if (burnt) {
        burnFX(pos);
      }
 else {
        evaporateFX(pos);
      }
    }
    if (isEmpty()) {
      destroy();
    }
 else     if (sprite != null) {
      sprite.view(image(),glowing());
    }
  }
}

Fixed version (ground truth):
public void burn(){
  if (type == Type.MIMIC) {
    Mimic m=Mimic.spawnAt(pos,items);
    if (m != null) {
      Buff.affect(m,Burning.class).reignite(m);
      m.sprite.emitter().burst(FlameParticle.FACTORY,5);
      destroy();
    }
  }
  if (type != Type.HEAP) {
    return;
  }
  boolean burnt=false;
  boolean evaporated=false;
  for (  Item item : items.toArray(new Item[0])) {
    if (item instanceof Scroll) {
      items.remove(item);
      burnt=true;
    }
 else     if (item instanceof Dewdrop) {
      items.remove(item);
      evaporated=true;
    }
 else     if (item instanceof MysteryMeat) {
      replace(item,ChargrilledMeat.cook((MysteryMeat)item));
      burnt=true;
    }
 else     if (item instanceof Bomb) {
      items.remove(item);
      ((Bomb)item).explode(pos);
      return;
    }
  }
  if (burnt || evaporated) {
    if (Dungeon.visible[pos]) {
      if (burnt) {
        burnFX(pos);
      }
 else {
        evaporateFX(pos);
      }
    }
    if (isEmpty()) {
      destroy();
    }
 else     if (sprite != null) {
      sprite.view(items.peek());
    }
  }
}
Program: 164200
Project: 164200
Buggy source:
public void freeze(){
  if (type == Type.MIMIC) {
    Mimic m=Mimic.spawnAt(pos,items);
    if (m != null) {
      Buff.prolong(m,Frost.class,Frost.duration(m) * Random.Float(1.0f,1.5f));
      destroy();
    }
  }
  if (type != Type.HEAP) {
    return;
  }
  boolean frozen=false;
  for (  Item item : items.toArray(new Item[0])) {
    if (item instanceof MysteryMeat) {
      replace(item,FrozenCarpaccio.cook((MysteryMeat)item));
      frozen=true;
    }
 else     if (item instanceof Potion) {
      items.remove(item);
      ((Potion)item).shatter(pos);
      frozen=true;
    }
 else     if (item instanceof Bomb) {
      ((Bomb)item).fuse=null;
      frozen=true;
    }
  }
  if (frozen) {
    if (isEmpty()) {
      destroy();
    }
 else     if (sprite != null) {
      sprite.view(image(),glowing());
    }
  }
}

Fixed version (ground truth):
public void freeze(){
  if (type == Type.MIMIC) {
    Mimic m=Mimic.spawnAt(pos,items);
    if (m != null) {
      Buff.prolong(m,Frost.class,Frost.duration(m) * Random.Float(1.0f,1.5f));
      destroy();
    }
  }
  if (type != Type.HEAP) {
    return;
  }
  boolean frozen=false;
  for (  Item item : items.toArray(new Item[0])) {
    if (item instanceof MysteryMeat) {
      replace(item,FrozenCarpaccio.cook((MysteryMeat)item));
      frozen=true;
    }
 else     if (item instanceof Potion) {
      items.remove(item);
      ((Potion)item).shatter(pos);
      frozen=true;
    }
 else     if (item instanceof Bomb) {
      ((Bomb)item).fuse=null;
      frozen=true;
    }
  }
  if (frozen) {
    if (isEmpty()) {
      destroy();
    }
 else     if (sprite != null) {
      sprite.view(items.peek());
    }
  }
}
Program: 164201
Project: 164201
Buggy source:
public void explode(){
  if (type == Type.MIMIC || type == Type.CHEST || type == Type.SKELETON) {
    type=Type.HEAP;
    sprite.link();
    sprite.drop();
    return;
  }
  if (type != Type.HEAP) {
    return;
  }
 else {
    for (    Item item : items.toArray(new Item[0])) {
      if (item instanceof Potion) {
        items.remove(item);
        ((Potion)item).shatter(pos);
      }
 else       if (item instanceof Bomb) {
        items.remove(item);
        ((Bomb)item).explode(pos);
        return;
      }
 else       if (!(item.level() > 0 || item.unique))       items.remove(item);
    }
    if (items.isEmpty())     destroy();
  }
}

Fixed version (ground truth):
public void explode(){
  if (type == Type.MIMIC || type == Type.CHEST || type == Type.SKELETON) {
    type=Type.HEAP;
    sprite.link();
    sprite.drop();
    return;
  }
  if (type != Type.HEAP) {
    return;
  }
 else {
    for (    Item item : items.toArray(new Item[0])) {
      if (item instanceof Potion) {
        items.remove(item);
        ((Potion)item).shatter(pos);
      }
 else       if (item instanceof Bomb) {
        items.remove(item);
        ((Bomb)item).explode(pos);
        return;
      }
 else       if (!(item.level() > 0 || item.unique))       items.remove(item);
    }
    if (isEmpty()) {
      destroy();
    }
 else     if (sprite != null) {
      sprite.view(items.peek());
    }
  }
}
Program: 164203
Project: 164203
Buggy source:
@Override public void call(){
  if (ch != null) {
    int count=10;
    int pos;
    do {
      pos=Dungeon.level.randomRespawnCell();
      if (count-- <= 0) {
        break;
      }
    }
 while (pos == -1);
    if (pos == -1 || Dungeon.bossLevel()) {
      GLog.w(Messages.get(ScrollOfTeleportation.class,"String_Node_Str"));
    }
 else     if (ch.properties().contains(Char.Property.IMMOVABLE)) {
      GLog.w(Messages.get(this,"String_Node_Str"));
    }
 else {
      ch.pos=pos;
      ch.sprite.place(ch.pos);
      ch.sprite.visible=Dungeon.visible[pos];
    }
  }
  curUser.spendAndNext(1f);
}

Fixed version (ground truth):
@Override public void call(){
  if (ch != null) {
    int count=10;
    int pos;
    do {
      pos=Dungeon.level.randomRespawnCell();
      if (count-- <= 0) {
        break;
      }
    }
 while (pos == -1);
    if (pos == -1 || Dungeon.bossLevel()) {
      GLog.w(Messages.get(ScrollOfTeleportation.class,"String_Node_Str"));
    }
 else     if (ch.properties().contains(Char.Property.IMMOVABLE)) {
      GLog.w(Messages.get(LloydsBeacon.class,"String_Node_Str"));
    }
 else {
      ch.pos=pos;
      ch.sprite.place(ch.pos);
      ch.sprite.visible=Dungeon.visible[pos];
    }
  }
  curUser.spendAndNext(1f);
}
Program: 164204
Project: 164204
Buggy source:
@Override public String prompt(){
  return Messages.get(this,"String_Node_Str");
}

Fixed version (ground truth):
@Override public String prompt(){
  return Messages.get(LloydsBeacon.class,"String_Node_Str");
}
Program: 164206
Project: 164206
Buggy source:
@Override protected void onClick(){
  if (Badges.isUnlocked(Badges.Badge.VICTORY)) {
    StartScene.this.add(new WndChallenges(ShatteredPixelDungeon.challenges(),true){
      public void onBackPressed(){
        super.onBackPressed();
        image.copy(Icons.get(ShatteredPixelDungeon.challenges() > 0 ? Icons.CHALLENGE_ON : Icons.CHALLENGE_OFF));
      }
    }
);
  }
 else {
    StartScene.this.add(new WndMessage(Messages.get(this,"String_Node_Str")));
  }
}

Fixed version (ground truth):
@Override protected void onClick(){
  if (Badges.isUnlocked(Badges.Badge.VICTORY)) {
    StartScene.this.add(new WndChallenges(ShatteredPixelDungeon.challenges(),true){
      public void onBackPressed(){
        super.onBackPressed();
        image.copy(Icons.get(ShatteredPixelDungeon.challenges() > 0 ? Icons.CHALLENGE_ON : Icons.CHALLENGE_OFF));
      }
    }
);
  }
 else {
    StartScene.this.add(new WndMessage(Messages.get(StartScene.class,"String_Node_Str")));
  }
}
Program: 164208
Project: 164208
Buggy source:
public static WndBag sell(){
  return GameScene.selectItem(itemSelector,WndBag.Mode.FOR_SALE,"String_Node_Str");
}

Fixed version (ground truth):
public static WndBag sell(){
  return GameScene.selectItem(itemSelector,WndBag.Mode.FOR_SALE,Messages.get(Shopkeeper.class,"String_Node_Str"));
}
Program: 164209
Project: 164209
Buggy source:
@Override public String prompt(){
  return Messages.get(this,"String_Node_Str");
}

Fixed version (ground truth):
@Override public String prompt(){
  return Messages.get(EtherealChains.class,"String_Node_Str");
}
Program: 164211
Project: 164211
Buggy source:
@Override protected void layout(){
  super.layout();
  shield.x=x;
  shield.y=y + (height - shield.height) / 2;
  position.x=shield.x + (shield.width - position.width()) / 2;
  position.y=shield.y + (shield.height - position.height()) / 2 + 1;
  if (flare != null) {
    flare.point(shield.center());
  }
  classIcon.x=x + width - classIcon.width;
  classIcon.y=shield.y;
  level.x=classIcon.x + (classIcon.width - level.width()) / 2;
  level.y=classIcon.y + (classIcon.height - level.height()) / 2 + 1;
  steps.x=x + width - steps.width - classIcon.width;
  steps.y=shield.y;
  depth.x=steps.x + (steps.width - depth.width()) / 2;
  depth.y=steps.y + (steps.height - depth.height()) / 2 + 1;
  desc.maxWidth((int)(steps.x - desc.left()));
  desc.setPos(shield.x + shield.width + GAP,shield.y + (shield.height - desc.height()) / 2 + 1);
}

Fixed version (ground truth):
@Override protected void layout(){
  super.layout();
  shield.x=x;
  shield.y=y + (height - shield.height) / 2;
  position.x=shield.x + (shield.width - position.width()) / 2;
  position.y=shield.y + (shield.height - position.height()) / 2 + 1;
  if (flare != null) {
    flare.point(shield.center());
  }
  classIcon.x=x + width - classIcon.width;
  classIcon.y=shield.y;
  level.x=classIcon.x + (classIcon.width - level.width()) / 2;
  level.y=classIcon.y + (classIcon.height - level.height()) / 2 + 1;
  steps.x=x + width - steps.width - classIcon.width;
  steps.y=shield.y;
  depth.x=steps.x + (steps.width - depth.width()) / 2;
  depth.y=steps.y + (steps.height - depth.height()) / 2 + 1;
  desc.maxWidth((int)(steps.x - (shield.x + shield.width + GAP)));
  desc.setPos(shield.x + shield.width + GAP,shield.y + (shield.height - desc.height()) / 2 + 1);
}
Program: 164212
Project: 164212
Buggy source:
public GameLog(){
  super();
  GLog.update.add(this);
  recreateLines();
}

Fixed version (ground truth):
public GameLog(){
  super();
  GLog.update.replace(this);
  recreateLines();
}
Program: 164213
Project: 164213
Buggy source:
@Override protected void nowhereToRun(){
  if (buff(Terror.class) == null && buff(Corruption.class) == null) {
    if (enemySeen) {
      sprite.showStatus(CharSprite.NEGATIVE,Messages.get(this,"String_Node_Str"));
      state=HUNTING;
    }
 else {
      int count=32;
      int newPos;
      do {
        newPos=Dungeon.level.randomRespawnCell();
        if (count-- <= 0) {
          break;
        }
      }
 while (newPos == -1 || Dungeon.visible[newPos] || Level.distance(newPos,pos) < (count / 3));
      if (newPos != -1) {
        if (Dungeon.visible[pos])         CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL),6);
        pos=newPos;
        sprite.place(pos);
        sprite.visible=Dungeon.visible[pos];
        if (Dungeon.visible[pos])         CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL),6);
      }
      if (item != null)       GLog.n(Messages.get(this,"String_Node_Str",item.name()));
      item=null;
      state=WANDERING;
    }
  }
 else {
    super.nowhereToRun();
  }
}

Fixed version (ground truth):
@Override protected void nowhereToRun(){
  if (buff(Terror.class) == null && buff(Corruption.class) == null) {
    if (enemySeen) {
      sprite.showStatus(CharSprite.NEGATIVE,Messages.get(Mob.class,"String_Node_Str"));
      state=HUNTING;
    }
 else {
      int count=32;
      int newPos;
      do {
        newPos=Dungeon.level.randomRespawnCell();
        if (count-- <= 0) {
          break;
        }
      }
 while (newPos == -1 || Dungeon.visible[newPos] || Level.distance(newPos,pos) < (count / 3));
      if (newPos != -1) {
        if (Dungeon.visible[pos])         CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL),6);
        pos=newPos;
        sprite.place(pos);
        sprite.visible=Dungeon.visible[pos];
        if (Dungeon.visible[pos])         CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL),6);
      }
      if (item != null)       GLog.n(Messages.get(this,"String_Node_Str",item.name()));
      item=null;
      state=WANDERING;
    }
  }
 else {
    super.nowhereToRun();
  }
}
Program: 164214
Project: 164214
Buggy source:
public void showParams(boolean TL,boolean TR,boolean BR){
  if (TL)   add(topLeft);
 else   remove(topLeft);
  if (TR)   add(topRight);
 else   remove(topRight);
  if (BR)   add(bottomRight);
 else   remove(bottomRight);
}

Fixed version (ground truth):
public void showParams(boolean TL,boolean TR,boolean BR){
  if (TL)   add(topLeft);
 else   remove(topLeft);
  if (TR)   add(topRight);
 else   remove(topRight);
  if (BR)   add(bottomRight);
 else   remove(bottomRight);
  iconVisible=BR;
}
Program: 164216
Project: 164216
Buggy source:
@Override public boolean act(){
  LockedFloor lock=target.buff(LockedFloor.class);
  if (charge < chargeCap && !cursed && (lock == null || lock.regenOn())) {
    partialCharge+=0.25f + (0.015f * level());
    if (partialCharge >= 36) {
      charge++;
      partialCharge-=36;
      if (charge == chargeCap)       image=ItemSpriteSheet.ARTIFACT_HORN4;
 else       if (charge >= 7)       image=ItemSpriteSheet.ARTIFACT_HORN3;
 else       if (charge >= 3)       image=ItemSpriteSheet.ARTIFACT_HORN2;
 else       image=ItemSpriteSheet.ARTIFACT_HORN1;
      if (charge == chargeCap) {
        GLog.p(Messages.get(this,"String_Node_Str"));
        partialCharge=0;
      }
      updateQuickslot();
    }
  }
 else   partialCharge=0;
  spend(TICK);
  return true;
}

Fixed version (ground truth):
@Override public boolean act(){
  LockedFloor lock=target.buff(LockedFloor.class);
  if (charge < chargeCap && !cursed && (lock == null || lock.regenOn())) {
    partialCharge+=0.25f + (0.015f * level());
    if (partialCharge >= 36) {
      charge++;
      partialCharge-=36;
      if (charge == chargeCap)       image=ItemSpriteSheet.ARTIFACT_HORN4;
 else       if (charge >= 7)       image=ItemSpriteSheet.ARTIFACT_HORN3;
 else       if (charge >= 3)       image=ItemSpriteSheet.ARTIFACT_HORN2;
 else       image=ItemSpriteSheet.ARTIFACT_HORN1;
      if (charge == chargeCap) {
        GLog.p(Messages.get(HornOfPlenty.class,"String_Node_Str"));
        partialCharge=0;
      }
      updateQuickslot();
    }
  }
 else   partialCharge=0;
  spend(TICK);
  return true;
}
Program: 164217
Project: 164217
Buggy source:
@Override protected void layout(){
  health.visible=!Float.isNaN(healthLvl);
  imIcon.x=x;
  imIcon.y=y;
  tfLabel.setPos(imIcon.x + imIcon.width() + GAP,imIcon.height > tfLabel.height() ? imIcon.y + (imIcon.height() - tfLabel.height()) / 2 : imIcon.y);
  tfLabel.maxWidth((int)(width - tfLabel.left()));
  if (health.visible) {
    health.setRect(tfLabel.left(),Math.max(tfLabel.top() + tfLabel.height(),imIcon.y + imIcon.height() - health.height()),tfLabel.maxWidth(),0);
    height=health.bottom();
  }
 else {
    height=Math.max(imIcon.height(),tfLabel.height());
  }
}

Fixed version (ground truth):
@Override protected void layout(){
  health.visible=!Float.isNaN(healthLvl);
  imIcon.x=x;
  imIcon.y=y;
  tfLabel.maxWidth((int)(width - (imIcon.x + imIcon.width() + GAP)));
  tfLabel.setPos(imIcon.x + imIcon.width() + GAP,imIcon.height > tfLabel.height() ? imIcon.y + (imIcon.height() - tfLabel.height()) / 2 : imIcon.y);
  if (health.visible) {
    health.setRect(tfLabel.left(),Math.max(tfLabel.top() + tfLabel.height(),imIcon.y + imIcon.height() - health.height()),tfLabel.maxWidth(),0);
    height=health.bottom();
  }
 else {
    height=Math.max(imIcon.height(),tfLabel.height());
  }
}
Program: 164218
Project: 164218
Buggy source:
public static void setup(String region){
  strings=new HashMap<>();
  Locale locale=new Locale(region);
  for (  String file : prop_files) {
    ResourceBundle bundle=ResourceBundle.getBundle(file,locale);
    Enumeration<String> keys=bundle.getKeys();
    while (keys.hasMoreElements()) {
      String key=keys.nextElement();
      strings.put(key,bundle.getString(key));
    }
  }
}

Fixed version (ground truth):
public static void setup(String region){
  strings=new HashMap<>();
  Locale locale=new Locale(region);
  for (  String file : prop_files) {
    ResourceBundle bundle=ResourceBundle.getBundle(file,locale);
    Enumeration<String> keys=bundle.getKeys();
    while (keys.hasMoreElements()) {
      String key=keys.nextElement();
      String value=bundle.getString(key);
      if (android.os.Build.VERSION.SDK_INT == 8) {
        try {
          value=new String(value.getBytes("String_Node_Str"),"String_Node_Str");
        }
 catch (        Exception e) {
        }
      }
      strings.put(key,value);
    }
  }
}
Program: 164219
Project: 164219
Buggy source:
@Override public void trigger(){
  if (Dungeon.visible[pos]) {
    Sample.INSTANCE.play(Assets.SND_TRAP);
  }
  reveal();
  activate();
}

Fixed version (ground truth):
@Override public void trigger(){
  if (Dungeon.visible[pos]) {
    Sample.INSTANCE.play(Assets.SND_TRAP);
  }
  reveal();
  Level.set(pos,Terrain.TRAP);
  activate();
}
Program: 164220
Project: 164220
Buggy source:
@Override protected void onClick(){
  if (thievery.steal(price)) {
    Hero hero=Dungeon.hero;
    Item item=heap.pickUp();
    GLog.i(Messages.get(this,"String_Node_Str",item.name()));
    hide();
    if (!item.doPickUp(hero)) {
      Dungeon.level.drop(item,heap.pos).sprite.drop();
    }
  }
 else {
    for (    Mob mob : Dungeon.level.mobs) {
      if (mob instanceof Shopkeeper) {
        mob.yell(Messages.get(mob,"String_Node_Str"));
        ((Shopkeeper)mob).flee();
        break;
      }
    }
    hide();
  }
}

Fixed version (ground truth):
@Override protected void onClick(){
  if (thievery.steal(price)) {
    Hero hero=Dungeon.hero;
    Item item=heap.pickUp();
    GLog.i(Messages.get(WndTradeItem.class,"String_Node_Str",item.name()));
    hide();
    if (!item.doPickUp(hero)) {
      Dungeon.level.drop(item,heap.pos).sprite.drop();
    }
  }
 else {
    for (    Mob mob : Dungeon.level.mobs) {
      if (mob instanceof Shopkeeper) {
        mob.yell(Messages.get(mob,"String_Node_Str"));
        ((Shopkeeper)mob).flee();
        break;
      }
    }
    hide();
  }
}
Program: 164222
Project: 164222
Buggy source:
public WndInfoBuff(Buff buff){
  super();
  IconTitle titlebar=new IconTitle();
  icons=TextureCache.get(Assets.BUFFS_LARGE);
  film=new TextureFilm(icons,16,16);
  Image buffIcon=new Image(icons);
  buffIcon.frame(film.get(buff.icon()));
  titlebar.icon(buffIcon);
  titlebar.label(Utils.capitalize(buff.toString()),Window.TITLE_COLOR);
  titlebar.setRect(0,0,WIDTH,0);
  add(titlebar);
  RenderedTextMultiline txtInfo=PixelScene.renderMultiline(buff.desc(),6);
  txtInfo.maxWidth(width);
  txtInfo.setPos(titlebar.left(),titlebar.bottom() + GAP);
  add(txtInfo);
  resize(WIDTH,(int)(txtInfo.top() + txtInfo.height()));
}

Fixed version (ground truth):
public WndInfoBuff(Buff buff){
  super();
  IconTitle titlebar=new IconTitle();
  icons=TextureCache.get(Assets.BUFFS_LARGE);
  film=new TextureFilm(icons,16,16);
  Image buffIcon=new Image(icons);
  buffIcon.frame(film.get(buff.icon()));
  titlebar.icon(buffIcon);
  titlebar.label(Utils.capitalize(buff.toString()),Window.TITLE_COLOR);
  titlebar.setRect(0,0,WIDTH,0);
  add(titlebar);
  RenderedTextMultiline txtInfo=PixelScene.renderMultiline(buff.desc(),6);
  txtInfo.maxWidth(WIDTH);
  txtInfo.setPos(titlebar.left(),titlebar.bottom() + GAP);
  add(txtInfo);
  resize(WIDTH,(int)(txtInfo.top() + txtInfo.height()));
}
Program: 164223
Project: 164223
Buggy source:
public static RenderedText renderText(String text,int size){
  int zoom=Math.min(defaultZoom,5);
  RenderedText result=new RenderedText(text,size * zoom);
  result.scale.set(1 / (float)zoom);
  return result;
}

Fixed version (ground truth):
public static RenderedText renderText(String text,int size){
  int zoom=Math.min(defaultZoom,5);
  RenderedText result=new RenderedText(text,size * zoom);
  result.scale.set(1 / (float)zoom + .001f);
  return result;
}
Program: 164224
Project: 164224
Buggy source:
public static RenderedTextMultiline renderMultiline(String text,int size){
  int zoom=Math.min(defaultZoom,5);
  RenderedTextMultiline result=new RenderedTextMultiline(text,size * zoom);
  result.zoom(1 / (float)zoom);
  return result;
}

Fixed version (ground truth):
public static RenderedTextMultiline renderMultiline(String text,int size){
  int zoom=Math.min(defaultZoom,5);
  RenderedTextMultiline result=new RenderedTextMultiline(text,size * zoom);
  result.zoom(1 / (float)zoom + .001f);
  return result;
}
Program: 164225
Project: 164225
Buggy source:
private static void add(Actor actor,float time){
  if (all.contains(actor)) {
    return;
  }
  ids.put(actor.id(),actor);
  all.add(actor);
  actor.time=time;
  actor.onAdd();
  if (actor instanceof Char) {
    Char ch=(Char)actor;
    chars.add(ch);
    for (    Buff buff : ch.buffs()) {
      all.add(buff);
      buff.onAdd();
    }
  }
}

Fixed version (ground truth):
private static void add(Actor actor,float time){
  if (all.contains(actor)) {
    return;
  }
  ids.put(actor.id(),actor);
  all.add(actor);
  actor.time+=time;
  actor.onAdd();
  if (actor instanceof Char) {
    Char ch=(Char)actor;
    chars.add(ch);
    for (    Buff buff : ch.buffs()) {
      all.add(buff);
      buff.onAdd();
    }
  }
}
Program: 164226
Project: 164226
Buggy source:
public static void init(){
  addDelayed(Dungeon.hero,-Float.MIN_VALUE);
  for (  Mob mob : Dungeon.level.mobs) {
    add(mob);
  }
  for (  Blob blob : Dungeon.level.blobs.values()) {
    add(blob);
  }
  current=null;
}

Fixed version (ground truth):
public static void init(){
  add(Dungeon.hero);
  for (  Mob mob : Dungeon.level.mobs) {
    add(mob);
  }
  for (  Blob blob : Dungeon.level.blobs.values()) {
    add(blob);
  }
  current=null;
}
Program: 164228
Project: 164228
Buggy source:
@Override protected boolean act(){
  if (Dungeon.level.map[pos] != Terrain.GRASS && Dungeon.level.map[pos] != Terrain.HIGH_GRASS) {
    destroy();
    sprite.die();
    return true;
  }
 else {
    if (enemy == null || !Level.adjacent(pos,enemy.pos)) {
      HP=Math.min(HT,HP + 3);
    }
    return super.act();
  }
}

Fixed version (ground truth):
@Override protected boolean act(){
  if (enemy == null || !Level.adjacent(pos,enemy.pos)) {
    HP=Math.min(HT,HP + 3);
  }
  return super.act();
}
Program: 164229
Project: 164229
Buggy source:
@Override public void damage(int dmg,Object src){
  LockedFloor lock=Dungeon.hero.buff(LockedFloor.class);
  if (lock != null) {
    int multiple=HP > HT / 2 ? 1 : 4;
    lock.addTime(dmg * multiple);
  }
  if (dmg >= HP) {
    ((PrisonBossLevel)Dungeon.level).progress();
    return;
  }
  int beforeHitHP=HP;
  super.damage(dmg,src);
  int hpBracket=HP > HT / 2 ? 12 : 20;
  if (beforeHitHP > HT / 2 && HP <= HT / 2) {
    HP=(HT / 2) - 1;
    yell("String_Node_Str");
    ((PrisonBossLevel)Dungeon.level).progress();
    BossHealthBar.bleed(true);
  }
 else   if (beforeHitHP / hpBracket != HP / hpBracket) {
    jump();
  }
}

Fixed version (ground truth):
@Override public void damage(int dmg,Object src){
  LockedFloor lock=Dungeon.hero.buff(LockedFloor.class);
  if (lock != null) {
    int multiple=HP > HT / 2 ? 1 : 4;
    lock.addTime(dmg * multiple);
  }
  if (dmg >= HP) {
    if (state == SLEEPING) {
      state=WANDERING;
    }
    ((PrisonBossLevel)Dungeon.level).progress();
    return;
  }
  int beforeHitHP=HP;
  super.damage(dmg,src);
  int hpBracket=HP > HT / 2 ? 12 : 20;
  if (beforeHitHP > HT / 2 && HP <= HT / 2) {
    HP=(HT / 2) - 1;
    yell("String_Node_Str");
    ((PrisonBossLevel)Dungeon.level).progress();
    BossHealthBar.bleed(true);
  }
 else   if (beforeHitHP / hpBracket != HP / hpBracket) {
    jump();
  }
}
Program: 164230
Project: 164230
Buggy source:
private void jump(){
  for (int i=0; i < 4; i++) {
    int trapPos;
    do {
      trapPos=Random.Int(Level.LENGTH);
    }
 while (!Level.fieldOfView[trapPos] || Level.solid[trapPos]);
    if (Dungeon.level.map[trapPos] == Terrain.INACTIVE_TRAP) {
      Dungeon.level.setTrap(new SpearTrap().reveal(),trapPos);
      Level.set(trapPos,Terrain.TRAP);
      ScrollOfMagicMapping.discover(trapPos);
    }
  }
  int newPos;
  if (HP > HT / 2) {
    do {
      newPos=Random.Int(Level.LENGTH);
    }
 while (!Level.fieldOfView[newPos] || Level.solid[newPos] || Level.adjacent(newPos,enemy.pos)|| Actor.findChar(newPos) != null);
  }
 else {
    do {
      newPos=Random.Int(Level.LENGTH);
    }
 while (Level.solid[newPos] || Level.distance(newPos,enemy.pos) < 8 || Actor.findChar(newPos) != null);
  }
  if (Dungeon.visible[pos])   CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL),6);
  sprite.move(pos,newPos);
  move(newPos);
  if (Dungeon.visible[newPos])   CellEmitter.get(newPos).burst(Speck.factory(Speck.WOOL),6);
  Sample.INSTANCE.play(Assets.SND_PUFF);
  spend(1 / speed());
}

Fixed version (ground truth):
private void jump(){
  for (int i=0; i < 4; i++) {
    int trapPos;
    do {
      trapPos=Random.Int(Level.LENGTH);
    }
 while (!Level.fieldOfView[trapPos] || Level.solid[trapPos]);
    if (Dungeon.level.map[trapPos] == Terrain.INACTIVE_TRAP) {
      Dungeon.level.setTrap(new SpearTrap().reveal(),trapPos);
      Level.set(trapPos,Terrain.TRAP);
      ScrollOfMagicMapping.discover(trapPos);
    }
  }
  int newPos;
  if (HP > HT / 2) {
    do {
      newPos=Random.Int(Level.LENGTH);
    }
 while (!(Dungeon.level.map[newPos] == Terrain.INACTIVE_TRAP || Dungeon.level.map[newPos] == Terrain.TRAP) || Level.solid[newPos] || Level.adjacent(newPos,enemy.pos)|| Actor.findChar(newPos) != null);
  }
 else {
    do {
      newPos=Random.Int(Level.LENGTH);
    }
 while (Level.solid[newPos] || Level.distance(newPos,enemy.pos) < 8 || Actor.findChar(newPos) != null);
  }
  if (Dungeon.visible[pos])   CellEmitter.get(pos).burst(Speck.factory(Speck.WOOL),6);
  sprite.move(pos,newPos);
  move(newPos);
  if (Dungeon.visible[newPos])   CellEmitter.get(newPos).burst(Speck.factory(Speck.WOOL),6);
  Sample.INSTANCE.play(Assets.SND_PUFF);
  spend(1 / speed());
}
Program: 164232
Project: 164232
Buggy source:
@Override public void call(){
  ch.onAttackComplete();
}

Fixed version (ground truth):
@Override public void call(){
  ch.next();
  if (enemy != null)   ch.attack(enemy);
}
Program: 164233
Project: 164233
Buggy source:
@Override public void attack(int cell){
  if (!Level.adjacent(cell,ch.pos)) {
    ((MissileSprite)parent.recycle(MissileSprite.class)).reset(ch.pos,cell,new Shuriken(),new Callback(){
      @Override public void call(){
        ch.onAttackComplete();
      }
    }
);
    play(cast);
    turnTo(ch.pos,cell);
  }
 else {
    super.attack(cell);
  }
}

Fixed version (ground truth):
@Override public void attack(int cell){
  if (!Level.adjacent(cell,ch.pos)) {
    final Char enemy=Actor.findChar(cell);
    ((MissileSprite)parent.recycle(MissileSprite.class)).reset(ch.pos,cell,new Shuriken(),new Callback(){
      @Override public void call(){
        ch.next();
        if (enemy != null)         ch.attack(enemy);
      }
    }
);
    play(cast);
    turnTo(ch.pos,cell);
  }
 else {
    super.attack(cell);
  }
}
Program: 164234
Project: 164234
Buggy source:
public void call(){
  ch.pos=newPos;
  if (ch.pos == trajectory.collisionPos) {
    ch.damage(Random.NormalIntRange((finalDist + 1) / 2,finalDist),this);
    Paralysis.prolong(ch,Paralysis.class,Random.NormalIntRange((finalDist + 1) / 2,finalDist));
  }
  Dungeon.level.press(ch.pos,ch);
}

Fixed version (ground truth):
public void call(){
  if (initialpos != ch.pos) {
    ch.sprite.place(ch.pos);
    return;
  }
  ch.pos=newPos;
  if (ch.pos == trajectory.collisionPos) {
    ch.damage(Random.NormalIntRange((finalDist + 1) / 2,finalDist),this);
    Paralysis.prolong(ch,Paralysis.class,Random.NormalIntRange((finalDist + 1) / 2,finalDist));
  }
  Dungeon.level.press(ch.pos,ch);
}
Program: 164235
Project: 164235
Buggy source:
private void throwChar(final Char ch,final Ballistica trajectory,int power){
  int dist=Math.min(trajectory.dist,power);
  if ((ch instanceof King) || (ch instanceof Golem) || (ch instanceof Yog.RottingFist))   dist/=2;
  if (dist == 0 || ch instanceof Yog || ch instanceof RotLasher || ch instanceof RotHeart)   return;
  if (Actor.findChar(trajectory.path.get(dist)) != null) {
    dist--;
  }
  final int newPos=trajectory.path.get(dist);
  if (newPos == ch.pos)   return;
  final int finalDist=dist;
  Actor.addDelayed(new Pushing(ch,ch.pos,newPos,new Callback(){
    public void call(){
      ch.pos=newPos;
      if (ch.pos == trajectory.collisionPos) {
        ch.damage(Random.NormalIntRange((finalDist + 1) / 2,finalDist),this);
        Paralysis.prolong(ch,Paralysis.class,Random.NormalIntRange((finalDist + 1) / 2,finalDist));
      }
      Dungeon.level.press(ch.pos,ch);
    }
  }
),-1);
}

Fixed version (ground truth):
private void throwChar(final Char ch,final Ballistica trajectory,int power){
  int dist=Math.min(trajectory.dist,power);
  if ((ch instanceof King) || (ch instanceof Golem) || (ch instanceof Yog.RottingFist))   dist/=2;
  if (dist == 0 || ch instanceof Yog || ch instanceof RotLasher || ch instanceof RotHeart)   return;
  if (Actor.findChar(trajectory.path.get(dist)) != null) {
    dist--;
  }
  final int newPos=trajectory.path.get(dist);
  if (newPos == ch.pos)   return;
  final int finalDist=dist;
  final int initialpos=ch.pos;
  Actor.addDelayed(new Pushing(ch,ch.pos,newPos,new Callback(){
    public void call(){
      if (initialpos != ch.pos) {
        ch.sprite.place(ch.pos);
        return;
      }
      ch.pos=newPos;
      if (ch.pos == trajectory.collisionPos) {
        ch.damage(Random.NormalIntRange((finalDist + 1) / 2,finalDist),this);
        Paralysis.prolong(ch,Paralysis.class,Random.NormalIntRange((finalDist + 1) / 2,finalDist));
      }
      Dungeon.level.press(ch.pos,ch);
    }
  }
),-1);
}
Program: 164236
Project: 164236
Buggy source:
@Override protected Char chooseEnemy(){
  if (potHolder == -1 && potPos == -1)   return Dungeon.hero;
 else   if (Actor.findById(potHolder) != null)   return (Char)Actor.findById(potHolder);
 else {
    if (enemy != null && enemy.isAlive() && Level.fieldOfView[enemy.pos] && enemy.invisible == 0 && Level.distance(enemy.pos,potPos) <= 3)     return enemy;
    HashSet<Char> enemies=new HashSet<Char>();
    for (    Mob mob : Dungeon.level.mobs)     if (!(mob instanceof Bee) && Level.distance(mob.pos,potPos) <= 3 && (mob.hostile || mob.ally))     enemies.add(mob);
    if (enemies.size() > 0)     return Random.element(enemies);
 else     return (Level.distance(Dungeon.hero.pos,potPos) <= 3) ? Dungeon.hero : null;
  }
}

Fixed version (ground truth):
@Override protected Char chooseEnemy(){
  if (potHolder == -1 && potPos == -1)   return Dungeon.hero;
 else   if (Actor.findById(potHolder) != null)   return (Char)Actor.findById(potHolder);
 else {
    if (enemy != null && enemy.isAlive() && Dungeon.level.mobs.contains(enemy) && Level.fieldOfView[enemy.pos] && enemy.invisible == 0 && Level.distance(enemy.pos,potPos) <= 3)     return enemy;
    HashSet<Char> enemies=new HashSet<Char>();
    for (    Mob mob : Dungeon.level.mobs)     if (!(mob instanceof Bee) && Level.distance(mob.pos,potPos) <= 3 && (mob.hostile || mob.ally))     enemies.add(mob);
    if (enemies.size() > 0)     return Random.element(enemies);
 else     return (Level.distance(Dungeon.hero.pos,potPos) <= 3) ? Dungeon.hero : null;
  }
}
Program: 164237
Project: 164237
Buggy source:
@Override public boolean act(boolean enemyInFOV,boolean justAlerted){
  enemySeen=enemyInFOV;
  if (enemyInFOV && !isCharmedBy(enemy) && canAttack(enemy)) {
    return doAttack(enemy);
  }
 else {
    if (enemyInFOV) {
      target=enemy.pos;
    }
    spend(TICK);
    return true;
  }
}

Fixed version (ground truth):
@Override public boolean act(boolean enemyInFOV,boolean justAlerted){
  enemySeen=enemyInFOV;
  if (enemyInFOV && !isCharmedBy(enemy) && canAttack(enemy)) {
    return doAttack(enemy);
  }
 else {
    if (enemyInFOV) {
      target=enemy.pos;
    }
 else {
      chooseEnemy();
      target=enemy.pos;
    }
    spend(TICK);
    return true;
  }
}
Program: 164238
Project: 164238
Buggy source:
public void progress(){
switch (state) {
case START:
    seal();
  set(5 + 25 * 32,Terrain.LOCKED_DOOR);
GameScene.updateMap(5 + 25 * 32);
tengu.state=tengu.HUNTING;
tengu.pos=5 + 28 * 32;
GameScene.add(tengu);
tengu.notice();
state=State.FIGHT_START;
break;
case FIGHT_START:
changeMap(MAP_MAZE);
clearHeaps((Room)new Room().set(0,5,8,32));
Actor.remove(tengu);
mobs.remove(tengu);
HealthIndicator.instance.target(null);
tengu.sprite.kill();
GameScene.flash(0xFFFFFF);
Sample.INSTANCE.play(Assets.SND_BLAST);
state=State.MAZE;
break;
case MAZE:
Dungeon.hero.interrupt();
Dungeon.hero.pos+=9 + 3 * 32;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
changeMap(MAP_ARENA);
clearHeaps(null);
tengu.state=tengu.HUNTING;
do {
tengu.pos=Random.Int(LENGTH);
}
 while (solid[tengu.pos] || distance(tengu.pos,Dungeon.hero.pos) < 8);
GameScene.add(tengu);
tengu.notice();
state=State.FIGHT_ARENA;
break;
case FIGHT_ARENA:
unseal();
CustomTileVisual vis=new exitVisual();
vis.pos(7,7);
customTiles.add(vis);
((GameScene)ShatteredPixelDungeon.scene()).addCustomTile(vis);
Dungeon.hero.interrupt();
Dungeon.hero.pos=5 + 27 * 32;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
tengu.pos=5 + 28 * 32;
tengu.sprite.place(5 + 28 * 32);
changeMap(MAP_END);
clearHeaps(null);
tengu.die(Dungeon.hero);
for (Item item : storedItems) drop(item,randomPrisonCell());
state=State.WON;
break;
}
}

Fixed version (ground truth):
public void progress(){
switch (state) {
case START:
    seal();
  set(5 + 25 * 32,Terrain.LOCKED_DOOR);
GameScene.updateMap(5 + 25 * 32);
tengu.state=tengu.HUNTING;
tengu.pos=5 + 28 * 32;
GameScene.add(tengu);
tengu.notice();
state=State.FIGHT_START;
break;
case FIGHT_START:
changeMap(MAP_MAZE);
clearEntities((Room)new Room().set(0,5,8,32));
Actor.remove(tengu);
mobs.remove(tengu);
HealthIndicator.instance.target(null);
tengu.sprite.kill();
GameScene.flash(0xFFFFFF);
Sample.INSTANCE.play(Assets.SND_BLAST);
state=State.MAZE;
break;
case MAZE:
Dungeon.hero.interrupt();
Dungeon.hero.pos+=9 + 3 * 32;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
changeMap(MAP_ARENA);
clearEntities(null);
tengu.state=tengu.HUNTING;
do {
tengu.pos=Random.Int(LENGTH);
}
 while (solid[tengu.pos] || distance(tengu.pos,Dungeon.hero.pos) < 8);
GameScene.add(tengu);
tengu.notice();
state=State.FIGHT_ARENA;
break;
case FIGHT_ARENA:
unseal();
CustomTileVisual vis=new exitVisual();
vis.pos(7,7);
customTiles.add(vis);
((GameScene)ShatteredPixelDungeon.scene()).addCustomTile(vis);
Dungeon.hero.interrupt();
Dungeon.hero.pos=5 + 27 * 32;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
tengu.pos=5 + 28 * 32;
tengu.sprite.place(5 + 28 * 32);
changeMap(MAP_END);
clearEntities(null);
tengu.die(Dungeon.hero);
for (Item item : storedItems) drop(item,randomPrisonCell());
state=State.WON;
break;
}
}
Program: 164239
Project: 164239
Buggy source:
public Group addVisuals(){
  visuals.clear();
  for (int i=0; i < LENGTH; i++) {
    if (pit[i]) {
      visuals.add(new WindParticle.Wind(i));
      if (i >= WIDTH && water[i - WIDTH]) {
        visuals.add(new FlowParticle.Flow(i - WIDTH));
      }
    }
  }
  return visuals;
}

Fixed version (ground truth):
public Group addVisuals(){
  if (visuals == null || visuals.parent == null) {
    visuals=new Group();
  }
 else {
    visuals.clear();
  }
  for (int i=0; i < LENGTH; i++) {
    if (pit[i]) {
      visuals.add(new WindParticle.Wind(i));
      if (i >= WIDTH && water[i - WIDTH]) {
        visuals.add(new FlowParticle.Flow(i - WIDTH));
      }
    }
  }
  return visuals;
}
Program: 164240
Project: 164240
Buggy source:
@Override public void destroy(){
  super.destroy();
  for (  Mob mob : Dungeon.level.mobs.toArray(new Mob[0])) {
    if (mob instanceof RotLasher) {
      mob.die(null);
    }
  }
}

Fixed version (ground truth):
@Override public void destroy(){
  super.destroy();
  for (  Mob mob : Dungeon.level.mobs.toArray(new Mob[Dungeon.level.mobs.size()])) {
    if (mob instanceof RotLasher) {
      mob.die(null);
    }
  }
}
Program: 164241
Project: 164241
Buggy source:
@Override protected void decorate(){
  for (int i=WIDTH + 1; i < LENGTH - WIDTH; i++) {
    if (map[i] == Terrain.EMPTY) {
      int n=0;
      if (map[i + 1] == Terrain.WALL) {
        n++;
      }
      if (map[i - 1] == Terrain.WALL) {
        n++;
      }
      if (map[i + WIDTH] == Terrain.WALL) {
        n++;
      }
      if (map[i - WIDTH] == Terrain.WALL) {
        n++;
      }
      if (Random.Int(8) <= n) {
        map[i]=Terrain.EMPTY_DECO;
      }
    }
  }
  for (int i=0; i < LENGTH; i++) {
    if (map[i] == Terrain.WALL && Random.Int(8) == 0) {
      map[i]=Terrain.WALL_DECO;
    }
  }
  int sign;
  do {
    sign=Random.Int(ROOM_LEFT,ROOM_RIGHT) + Random.Int(ROOM_TOP,ROOM_BOTTOM) * WIDTH;
  }
 while (sign == entrance);
  map[sign]=Terrain.SIGN;
}

Fixed version (ground truth):
@Override protected void decorate(){
  for (int i=WIDTH + 1; i < LENGTH - WIDTH; i++) {
    if (map[i] == Terrain.EMPTY) {
      int n=0;
      if (map[i + 1] == Terrain.WALL) {
        n++;
      }
      if (map[i - 1] == Terrain.WALL) {
        n++;
      }
      if (map[i + WIDTH] == Terrain.WALL) {
        n++;
      }
      if (map[i - WIDTH] == Terrain.WALL) {
        n++;
      }
      if (Random.Int(8) <= n) {
        map[i]=Terrain.EMPTY_DECO;
      }
    }
  }
  for (int i=0; i < LENGTH; i++) {
    if (map[i] == Terrain.WALL && Random.Int(8) == 0) {
      map[i]=Terrain.WALL_DECO;
    }
  }
  int sign;
  do {
    sign=Random.Int(ROOM_LEFT,ROOM_RIGHT) + Random.Int(ROOM_TOP,ROOM_BOTTOM) * WIDTH;
  }
 while (sign == entrance || map[sign] == Terrain.INACTIVE_TRAP);
  map[sign]=Terrain.SIGN;
}
Program: 164243
Project: 164243
Buggy source:
@Override protected boolean getFurther(int target){
  return false;
}

Fixed version (ground truth):
@Override protected boolean getFurther(int target){
  return true;
}
Program: 164244
Project: 164244
Buggy source:
@Override protected boolean act(){
  if (Dungeon.level.map[pos] != Terrain.GRASS && Dungeon.level.map[pos] != Terrain.HIGH_GRASS) {
    destroy();
    sprite.die();
    return true;
  }
 else {
    HP=Math.min(HT,HP + 2);
    return super.act();
  }
}

Fixed version (ground truth):
@Override protected boolean act(){
  if (Dungeon.level.map[pos] != Terrain.GRASS && Dungeon.level.map[pos] != Terrain.HIGH_GRASS) {
    destroy();
    sprite.die();
    return true;
  }
 else {
    if (enemy == null || !Level.adjacent(pos,enemy.pos)) {
      HP=Math.min(HT,HP + 3);
    }
    return super.act();
  }
}
Program: 164245
Project: 164245
Buggy source:
@Override protected boolean getCloser(int target){
  return false;
}

Fixed version (ground truth):
@Override protected boolean getCloser(int target){
  return true;
}
Program: 164246
Project: 164246
Buggy source:
public static boolean spawn(PrisonLevel level,Room room,Collection<Room> rooms){
  if (!spawned && Dungeon.depth > 6 && Random.Int(10 - Dungeon.depth) == 0 || type != 0) {
    if (type == 0)     type=Random.Int(Dungeon.isChallenged(Challenges.NO_HERBALISM) ? 2 : 3) + 1;
    if (setRoom(rooms)) {
      Wandmaker npc=new Wandmaker();
      do {
        npc.pos=room.random();
      }
 while (level.map[npc.pos] == Terrain.ENTRANCE || level.map[npc.pos] == Terrain.SIGN);
      level.mobs.add(npc);
      spawned=true;
      given=false;
      wand1=(Wand)Generator.random(Generator.Category.WAND);
      wand1.upgrade();
      do {
        wand2=(Wand)Generator.random(Generator.Category.WAND);
      }
 while (wand2.getClass().equals(wand1.getClass()));
      wand2.upgrade();
      return true;
    }
 else {
      return false;
    }
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
public static boolean spawn(PrisonLevel level,Room room,Collection<Room> rooms){
  if (!spawned && (type != 0 || (Dungeon.depth > 6 && Random.Int(10 - Dungeon.depth) == 0))) {
    if (type == 0)     type=Random.Int(Dungeon.isChallenged(Challenges.NO_HERBALISM) ? 2 : 3) + 1;
    if (setRoom(rooms)) {
      Wandmaker npc=new Wandmaker();
      do {
        npc.pos=room.random();
      }
 while (level.map[npc.pos] == Terrain.ENTRANCE || level.map[npc.pos] == Terrain.SIGN);
      level.mobs.add(npc);
      spawned=true;
      given=false;
      wand1=(Wand)Generator.random(Generator.Category.WAND);
      wand1.upgrade();
      do {
        wand2=(Wand)Generator.random(Generator.Category.WAND);
      }
 while (wand2.getClass().equals(wand1.getClass()));
      wand2.upgrade();
      return true;
    }
 else {
      return false;
    }
  }
 else {
    return true;
  }
}
Program: 164247
Project: 164247
Buggy source:
@Override protected void nowhereToRun(){
  if (buff(Terror.class) == null) {
    if (enemySeen) {
      sprite.showStatus(CharSprite.NEGATIVE,TXT_RAGE);
      state=HUNTING;
    }
 else {
      GLog.n("String_Node_Str" + item.name() + "String_Node_Str");
      item=null;
      state=WANDERING;
    }
  }
 else {
    super.nowhereToRun();
  }
}

Fixed version (ground truth):
@Override protected void nowhereToRun(){
  if (buff(Terror.class) == null) {
    if (enemySeen) {
      sprite.showStatus(CharSprite.NEGATIVE,TXT_RAGE);
      state=HUNTING;
    }
 else {
      if (item != null)       GLog.n("String_Node_Str" + item.name() + "String_Node_Str");
      item=null;
      state=WANDERING;
    }
  }
 else {
    super.nowhereToRun();
  }
}
Program: 164249
Project: 164249
Buggy source:
@Override public void damage(int dmg,Object src){
  if (dmg > HP) {
    ((PrisonBossLevel)Dungeon.level).progress();
    return;
  }
  int beforeHitHP=HP;
  super.damage(dmg,src);
  if (beforeHitHP > HT / 2 && HP <= HT / 2) {
    HP=HT / 2;
    yell("String_Node_Str");
    ((PrisonBossLevel)Dungeon.level).progress();
    BossHealthBar.bleed(true);
  }
}

Fixed version (ground truth):
@Override public void damage(int dmg,Object src){
  if (dmg >= HP) {
    ((PrisonBossLevel)Dungeon.level).progress();
    return;
  }
  int beforeHitHP=HP;
  super.damage(dmg,src);
  if (beforeHitHP > HT / 2 && HP <= HT / 2) {
    HP=HT / 2;
    yell("String_Node_Str");
    ((PrisonBossLevel)Dungeon.level).progress();
    BossHealthBar.bleed(true);
  }
}
Program: 164250
Project: 164250
Buggy source:
public void progress(){
switch (state) {
case START:
    seal();
  set(5 + 25 * 32,Terrain.LOCKED_DOOR);
GameScene.updateMap(5 + 25 * 32);
tengu.state=tengu.HUNTING;
tengu.pos=5 + 28 * 32;
GameScene.add(tengu);
tengu.notice();
state=State.FIGHT_START;
break;
case FIGHT_START:
changeMap(MAP_MAZE);
Actor.remove(tengu);
mobs.remove(tengu);
HealthIndicator.instance.target(null);
tengu.sprite.kill();
GameScene.flash(0xFFFFFF);
Sample.INSTANCE.play(Assets.SND_BLAST);
state=State.MAZE;
break;
case MAZE:
Dungeon.hero.interrupt();
Dungeon.hero.pos+=106;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
changeMap(MAP_ARENA);
tengu.state=tengu.HUNTING;
do {
tengu.pos=Random.Int(LENGTH);
}
 while (solid[tengu.pos] || distance(tengu.pos,Dungeon.hero.pos) < 8);
GameScene.add(tengu);
tengu.notice();
state=State.FIGHT_ARENA;
break;
case FIGHT_ARENA:
unseal();
CustomTileVisual vis=new exitVisual();
vis.pos(7,7);
customTiles.add(vis);
((GameScene)ShatteredPixelDungeon.scene()).addCustomTile(vis);
Dungeon.hero.interrupt();
Dungeon.hero.pos=5 + 27 * 32;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
changeMap(MAP_END);
tengu.pos=5 + 28 * 32;
tengu.sprite.interruptMotion();
tengu.sprite.place(5 + 28 * 32);
tengu.die(Dungeon.hero);
state=State.WON;
break;
}
}

Fixed version (ground truth):
public void progress(){
switch (state) {
case START:
    seal();
  set(5 + 25 * 32,Terrain.LOCKED_DOOR);
GameScene.updateMap(5 + 25 * 32);
tengu.state=tengu.HUNTING;
tengu.pos=5 + 28 * 32;
GameScene.add(tengu);
tengu.notice();
state=State.FIGHT_START;
break;
case FIGHT_START:
changeMap(MAP_MAZE);
Actor.remove(tengu);
mobs.remove(tengu);
HealthIndicator.instance.target(null);
tengu.sprite.kill();
GameScene.flash(0xFFFFFF);
Sample.INSTANCE.play(Assets.SND_BLAST);
state=State.MAZE;
break;
case MAZE:
Dungeon.hero.interrupt();
Dungeon.hero.pos+=106;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
changeMap(MAP_ARENA);
tengu.state=tengu.HUNTING;
do {
tengu.pos=Random.Int(LENGTH);
}
 while (solid[tengu.pos] || distance(tengu.pos,Dungeon.hero.pos) < 8);
GameScene.add(tengu);
tengu.notice();
state=State.FIGHT_ARENA;
break;
case FIGHT_ARENA:
unseal();
CustomTileVisual vis=new exitVisual();
vis.pos(7,7);
customTiles.add(vis);
((GameScene)ShatteredPixelDungeon.scene()).addCustomTile(vis);
Dungeon.hero.interrupt();
Dungeon.hero.pos=5 + 27 * 32;
Dungeon.hero.sprite.interruptMotion();
Dungeon.hero.sprite.place(Dungeon.hero.pos);
tengu.pos=5 + 28 * 32;
tengu.sprite.place(5 + 28 * 32);
changeMap(MAP_END);
tengu.die(Dungeon.hero);
state=State.WON;
break;
}
}
Program: 164251
Project: 164251
Buggy source:
public void call(){
  Actor.addDelayed(new Pushing(Dungeon.hero,Dungeon.hero.pos,newHeroPos),-1);
  Dungeon.hero.pos=newHeroPos;
  Dungeon.observe();
  Dungeon.level.press(newHeroPos,Dungeon.hero);
  Cripple.prolong(Dungeon.hero,Cripple.class,4f);
  Dungeon.hero.interrupt();
  next();
}

Fixed version (ground truth):
public void call(){
  Actor.addDelayed(new Pushing(enemy,enemy.pos,newPosFinal),-1);
  enemy.pos=newPosFinal;
  Dungeon.level.press(newPosFinal,enemy);
  Cripple.prolong(enemy,Cripple.class,4f);
  if (enemy == Dungeon.hero) {
    Dungeon.hero.interrupt();
    Dungeon.observe();
  }
  next();
}