nus-yam/ex-repair huggingface dataset:
Program: 158449
Project: 158449
Buggy source:
@Override public boolean apply(Game game,Ability source){
  int amount=0;
  boolean result=false;
  Player you=game.getPlayer(source.getControllerId());
  for (  UUID playerId : you.getInRange()) {
    if (!playerId.equals(source.getControllerId())) {
      Player otherPlayer=game.getPlayer(playerId);
      if (otherPlayer != null && otherPlayer.getHand().size() > 0) {
        TargetCardInHand target=new TargetCardInHand();
        if (otherPlayer.choose(Outcome.Discard,target,source.getSourceId(),game)) {
          Card card=game.getCard(target.getFirstTarget());
          if (card != null) {
            if (otherPlayer.discard(card,source,game)) {
              amount+=1;
              result=true;
              target.clearChosen();
            }
          }
        }
      }
    }
  }
  if (you != null) {
    you.drawCards(amount,game);
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  int amount=0;
  boolean result=false;
  Player you=game.getPlayer(source.getControllerId());
  if (you != null) {
    for (    UUID playerId : you.getInRange()) {
      if (!playerId.equals(source.getControllerId())) {
        Player otherPlayer=game.getPlayer(playerId);
        if (otherPlayer != null && otherPlayer.getHand().size() > 0) {
          TargetCardInHand target=new TargetCardInHand();
          if (otherPlayer.choose(Outcome.Discard,target,source.getSourceId(),game)) {
            Card card=game.getCard(target.getFirstTarget());
            if (card != null) {
              if (otherPlayer.discard(card,source,game)) {
                amount+=1;
                result=true;
                target.clearChosen();
              }
            }
          }
        }
      }
    }
    you.drawCards(amount,game);
  }
  return result;
}
Program: 158450
Project: 158450
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Player targetPlayer=game.getPlayer(this.getTargetPointer().getFirst(game,source));
  if (controller != null && targetPlayer != null) {
    game.getState().getTurnMods().add(new TurnMod(targetPlayer.getId(),false));
    game.getState().getTurnMods().add(new TurnMod(targetPlayer.getId(),controller.getId()));
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Player targetPlayer=game.getPlayer(this.getTargetPointer().getFirst(game,source));
  if (controller != null && targetPlayer != null) {
    game.getState().getTurnMods().add(new TurnMod(targetPlayer.getId(),false));
  }
  return super.apply(game,source);
}
Program: 158451
Project: 158451
Buggy source:
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  if (event.getType().equals(GameEvent.EventType.DISCARD_CARD)) {
    Card card=game.getCard(event.getTargetId());
    if (card != null) {
      cardId=card.getId();
      zoneChangeCounter=game.getState().getZoneChangeCounter(cardId);
    }
    return false;
  }
  if (event.getType().equals(GameEvent.EventType.ZONE_CHANGE)) {
    Player controller=game.getPlayer(source.getControllerId());
    Card card=game.getCard(event.getTargetId());
    if (controller != null && card != null) {
      cardId=null;
      zoneChangeCounter=0;
      if (controller.chooseUse(outcome,"String_Node_Str" + card.getIdName() + "String_Node_Str",source,game)) {
        Cards cardsToLibrary=new CardsImpl(card);
        controller.revealCards(card.getName(),cardsToLibrary,game);
        controller.putCardsOnTopOfLibrary(cardsToLibrary,game,source,false);
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  if (event.getType().equals(GameEvent.EventType.DISCARD_CARD)) {
    Card card=game.getCard(event.getTargetId());
    if (card != null) {
      boolean isAnOpponentEffect=false;
      MageObject object=game.getObject(event.getSourceId());
      if (object instanceof PermanentCard) {
        isAnOpponentEffect=game.getOpponents(source.getControllerId()).contains(((PermanentCard)object).getControllerId());
      }
 else       if (object instanceof Spell) {
        isAnOpponentEffect=game.getOpponents(source.getControllerId()).contains(((Spell)object).getControllerId());
      }
 else       if (object instanceof Card) {
        isAnOpponentEffect=game.getOpponents(source.getControllerId()).contains(((Card)object).getOwnerId());
      }
      if (isAnOpponentEffect) {
        cardId=card.getId();
        zoneChangeCounter=game.getState().getZoneChangeCounter(cardId);
      }
    }
    return false;
  }
  if (event.getType().equals(GameEvent.EventType.ZONE_CHANGE)) {
    Player controller=game.getPlayer(source.getControllerId());
    Card card=game.getCard(event.getTargetId());
    if (controller != null && card != null) {
      cardId=null;
      zoneChangeCounter=0;
      if (controller.chooseUse(outcome,"String_Node_Str" + card.getIdName() + "String_Node_Str",source,game)) {
        Cards cardsToLibrary=new CardsImpl(card);
        controller.revealCards(card.getName(),cardsToLibrary,game);
        controller.putCardsOnTopOfLibrary(cardsToLibrary,game,source,false);
        return true;
      }
    }
  }
  return false;
}
Program: 158452
Project: 158452
Buggy source:
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (event.getPlayerId().equals(source.getControllerId())) {
    MageObject object=game.getObject(event.getSourceId());
    if (object instanceof PermanentCard) {
      if (game.getOpponents(source.getControllerId()).contains(((PermanentCard)object).getControllerId())) {
        return true;
      }
    }
    if (object instanceof Spell) {
      if (game.getOpponents(source.getControllerId()).contains(((Spell)object).getControllerId())) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean applies(GameEvent event,Ability source,Game game){
  if (event.getPlayerId().equals(source.getControllerId())) {
    MageObject object=game.getObject(event.getSourceId());
    if (object instanceof PermanentCard) {
      if (game.getOpponents(source.getControllerId()).contains(((PermanentCard)object).getControllerId())) {
        return true;
      }
    }
    if (object instanceof Spell) {
      if (game.getOpponents(source.getControllerId()).contains(((Spell)object).getControllerId())) {
        return true;
      }
    }
    if (object instanceof Card) {
      if (game.getOpponents(source.getControllerId()).contains(((Card)object).getOwnerId())) {
        return true;
      }
    }
  }
  return false;
}
Program: 158453
Project: 158453
Buggy source:
@Test public void testUseWithMercilessExecutioner(){
  addCard(Zone.GRAVEYARD,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",5);
  addCard(Zone.GRAVEYARD,playerB,"String_Node_Str");
  addCard(Zone.HAND,playerB,"String_Node_Str");
  castSpell(2,PhaseStep.PRECOMBAT_MAIN,playerB,"String_Node_Str");
  setChoice(playerB,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setStopAt(2,PhaseStep.POSTCOMBAT_MAIN);
  execute();
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertGraveyardCount(playerA,"String_Node_Str",0);
  assertGraveyardCount(playerB,"String_Node_Str",0);
}

Fixed version (ground truth):
@Test public void testUseWithMercilessExecutioner(){
  addCard(Zone.GRAVEYARD,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",5);
  addCard(Zone.GRAVEYARD,playerB,"String_Node_Str");
  addCard(Zone.HAND,playerB,"String_Node_Str");
  castSpell(2,PhaseStep.PRECOMBAT_MAIN,playerB,"String_Node_Str");
  setChoice(playerB,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  setStopAt(2,PhaseStep.POSTCOMBAT_MAIN);
  execute();
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertGraveyardCount(playerA,"String_Node_Str",0);
  assertGraveyardCount(playerB,"String_Node_Str",1);
}
Program: 158454
Project: 158454
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (!onlyCombat || ((DamagedPlayerEvent)event).isCombatDamage()) {
    Permanent permanent=game.getPermanent(event.getSourceId());
    if (permanent != null && filter.match(permanent,sourceId,controllerId,game)) {
      if (!setTargetPointer.equals(SetTargetPointer.NONE)) {
        for (        Effect effect : this.getEffects()) {
          effect.setValue("String_Node_Str",event.getAmount());
switch (setTargetPointer) {
case PLAYER:
            effect.setTargetPointer(new FixedTarget(permanent.getControllerId()));
          break;
case PERMANENT:
        effect.setTargetPointer(new FixedTarget(permanent.getId(),permanent.getZoneChangeCounter(game)));
      break;
  }
}
}
return true;
}
}
return false;
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  if (!onlyCombat || ((DamagedPlayerEvent)event).isCombatDamage()) {
    Permanent permanent=game.getPermanent(event.getSourceId());
    if (permanent != null) {
      controllerId=permanent.getControllerId();
      if (filter.match(permanent,sourceId,controllerId,game)) {
        if (!setTargetPointer.equals(SetTargetPointer.NONE)) {
          for (          Effect effect : this.getEffects()) {
            effect.setValue("String_Node_Str",event.getAmount());
switch (setTargetPointer) {
case PLAYER:
              effect.setTargetPointer(new FixedTarget(permanent.getControllerId()));
            break;
case PERMANENT:
          effect.setTargetPointer(new FixedTarget(permanent.getId(),permanent.getZoneChangeCounter(game)));
        break;
    }
  }
}
return true;
}
}
}
return false;
}
Program: 158455
Project: 158455
Buggy source:
@Override public void adjustTargets(Ability ability,Game game){
  if (ability instanceof SpellAbility) {
    if (KickedCondition.getInstance().apply(game,ability)) {
      getSpellAbility().addTarget(new TargetLandPermanent(new FilterLandPermanent("String_Node_Str")));
    }
  }
}

Fixed version (ground truth):
@Override public void adjustTargets(Ability ability,Game game){
  if (ability instanceof SpellAbility) {
    if (KickedCondition.getInstance().apply(game,ability)) {
      ability.getTargets().clear();
      getSpellAbility().addTarget(new TargetLandPermanent(2));
    }
  }
}
Program: 158456
Project: 158456
Buggy source:
@Override public void adjustTargets(Ability ability,Game game){
  if (ability instanceof SpellAbility && KickedCondition.getInstance().apply(game,ability)) {
    ability.addTarget(new TargetOtherNonlandPermanent(new FilterNonlandPermanent("String_Node_Str")));
  }
}

Fixed version (ground truth):
@Override public void adjustTargets(Ability ability,Game game){
  if (ability instanceof SpellAbility && KickedCondition.getInstance().apply(game,ability)) {
    ability.getTargets().clear();
    ability.addTarget(new TargetNonlandPermanent(2));
  }
}
Program: 158457
Project: 158457
Buggy source:
@Override public TargetOtherNonlandPermanent copy(){
  return new TargetOtherNonlandPermanent(this);
}

Fixed version (ground truth):
@Override public RushingRiver copy(){
  return new RushingRiver(this);
}
Program: 158458
Project: 158458
Buggy source:
@Override public DissensionInTheRanksTarget copy(){
  return new DissensionInTheRanksTarget(this);
}

Fixed version (ground truth):
@Override public DissensionInTheRanks copy(){
  return new DissensionInTheRanks(this);
}
Program: 158459
Project: 158459
Buggy source:
@Override public boolean apply(Layer layer,SubLayer sublayer,Ability source,Game game){
  Permanent enchantment=game.getPermanent(source.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null) {
    Permanent permanent=game.getPermanent(enchantment.getAttachedTo());
    if (permanent != null) {
switch (layer) {
case ColorChangingEffects_5:
        permanent.getColor(game).setWhite(false);
      permanent.getColor(game).setGreen(false);
    permanent.getColor(game).setBlack(false);
  permanent.getColor(game).setBlue(false);
permanent.getColor(game).setRed(false);
break;
case AbilityAddingRemovingEffects_6:
permanent.removeAllAbilities(source.getSourceId(),game);
permanent.addAbility(new ColorlessManaAbility(),source.getSourceId(),game);
break;
case TypeChangingEffects_4:
permanent.getCardType().clear();
permanent.getCardType().add(CardType.LAND);
permanent.getSubtype().clear();
break;
}
return true;
}
}
return false;
}

Fixed version (ground truth):
@Override public boolean apply(Layer layer,SubLayer sublayer,Ability source,Game game){
  Permanent enchantment=game.getPermanent(source.getSourceId());
  if (enchantment != null && enchantment.getAttachedTo() != null) {
    Permanent permanent=game.getPermanent(enchantment.getAttachedTo());
    if (permanent != null) {
switch (layer) {
case ColorChangingEffects_5:
        permanent.getColor(game).setWhite(false);
      permanent.getColor(game).setGreen(false);
    permanent.getColor(game).setBlack(false);
  permanent.getColor(game).setBlue(false);
permanent.getColor(game).setRed(false);
break;
case AbilityAddingRemovingEffects_6:
permanent.removeAllAbilities(source.getSourceId(),game);
permanent.addAbility(new ColorlessManaAbility(),source.getSourceId(),game);
break;
case TypeChangingEffects_4:
boolean isLand=permanent.getCardType().contains(CardType.LAND);
permanent.getCardType().clear();
permanent.getCardType().add(CardType.LAND);
if (!isLand) {
permanent.getSubtype().clear();
}
break;
}
return true;
}
}
return false;
}
Program: 158460
Project: 158460
Buggy source:
@Override public boolean apply(Game game,Ability source){
  MageObject sourceObject=game.getObject(source.getSourceId());
  Player targetPlayer=game.getPlayer(source.getFirstTarget());
  String cardName=(String)game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
  if (sourceObject == null || targetPlayer == null || cardName == null || cardName.isEmpty()) {
    return false;
  }
  Cards cardsToReveal=new CardsImpl();
  Cards cardsToBury=new CardsImpl();
  boolean namedCardFound=false;
  while (targetPlayer.getLibrary().size() > 0) {
    Card card=targetPlayer.getLibrary().removeFromTop(game);
    if (card != null) {
      cardsToReveal.add(card);
      if (card.getName().equals(cardName)) {
        namedCardFound=true;
        targetPlayer.moveCards(cardsToBury,Zone.GRAVEYARD,source,game);
        targetPlayer.moveCards(card,Zone.LIBRARY,source,game);
        break;
      }
 else {
        cardsToBury.add(card);
      }
    }
  }
  targetPlayer.revealCards(sourceObject.getIdName(),cardsToReveal,game);
  if (!namedCardFound) {
    targetPlayer.shuffleLibrary(source,game);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  MageObject sourceObject=game.getObject(source.getSourceId());
  Player targetPlayer=game.getPlayer(source.getFirstTarget());
  String cardName=(String)game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY);
  if (sourceObject == null || targetPlayer == null || cardName == null || cardName.isEmpty()) {
    return false;
  }
  Cards cardsToReveal=new CardsImpl();
  Cards cardsToBury=new CardsImpl();
  Card namedCard=null;
  boolean namedCardFound=false;
  while (targetPlayer.getLibrary().size() > 0) {
    Card card=targetPlayer.getLibrary().removeFromTop(game);
    if (card != null) {
      cardsToReveal.add(card);
      if (card.getName().equals(cardName)) {
        namedCardFound=true;
        namedCard=card;
        break;
      }
 else {
        cardsToBury.add(card);
      }
    }
  }
  targetPlayer.revealCards(sourceObject.getIdName(),cardsToReveal,game);
  if (namedCardFound) {
    targetPlayer.moveCards(cardsToBury,Zone.GRAVEYARD,source,game);
    targetPlayer.moveCards(namedCard,Zone.LIBRARY,source,game);
  }
 else {
    targetPlayer.shuffleLibrary(source,game);
  }
  return true;
}
Program: 158461
Project: 158461
Buggy source:
@Test public void testCopyNoxiousGhoul(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",9);
  addCard(Zone.HAND,playerA,"String_Node_Str",1);
  addCard(Zone.HAND,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",3);
  addCard(Zone.HAND,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  castSpell(1,PhaseStep.POSTCOMBAT_MAIN,playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  castSpell(1,PhaseStep.POSTCOMBAT_MAIN,playerB,"String_Node_Str","String_Node_Str","String_Node_Str");
  setStopAt(1,PhaseStep.END_TURN);
  execute();
  assertPermanentCount(playerA,"String_Node_Str",2);
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertPowerToughness(playerA,"String_Node_Str",-1,1,Filter.ComparisonScope.All);
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertPowerToughness(playerB,"String_Node_Str",2,3);
  assertPowerToughness(playerA,"String_Node_Str",0,3);
}

Fixed version (ground truth):
@Test public void testCopyNoxiousGhoul(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",3);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",9);
  addCard(Zone.HAND,playerA,"String_Node_Str",1);
  addCard(Zone.HAND,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",3);
  addCard(Zone.HAND,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  castSpell(1,PhaseStep.POSTCOMBAT_MAIN,playerA,"String_Node_Str");
  setChoice(playerA,"String_Node_Str");
  castSpell(1,PhaseStep.POSTCOMBAT_MAIN,playerB,"String_Node_Str","String_Node_Str","String_Node_Str");
  setStopAt(1,PhaseStep.END_TURN);
  execute();
  assertPermanentCount(playerA,"String_Node_Str",2);
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertPowerToughness(playerA,"String_Node_Str",-1,1,Filter.ComparisonScope.All);
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertPowerToughness(playerB,"String_Node_Str",1,2);
  assertPowerToughness(playerA,"String_Node_Str",-1,2);
}
Program: 158462
Project: 158462
Buggy source:
/** 
 * Tests trigger won't happen after Soul Warden died
 */
@Test public void testDisabledEffectOnChangeZone(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",2);
  addCard(Zone.HAND,playerA,"String_Node_Str",2);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  castSpell(1,PhaseStep.POSTCOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str");
  castSpell(1,PhaseStep.POSTCOMBAT_MAIN,playerA,"String_Node_Str");
  setStopAt(1,PhaseStep.END_TURN);
  execute();
  assertLife(playerA,21);
  assertLife(playerB,20);
}

Fixed version (ground truth):
/** 
 * Tests trigger won't happen after Soul Warden died
 */
@Test public void testDisabledEffectOnChangeZone(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",4);
  addCard(Zone.HAND,playerA,"String_Node_Str",2);
  addCard(Zone.HAND,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  castSpell(1,PhaseStep.POSTCOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str");
  castSpell(1,PhaseStep.POSTCOMBAT_MAIN,playerA,"String_Node_Str");
  setStopAt(1,PhaseStep.END_TURN);
  execute();
  assertLife(playerA,23);
  assertLife(playerB,20);
}
Program: 158464
Project: 158464
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getFirstTarget());
  if (player == null) {
    return false;
  }
  if (player.searchLibrary(target,game)) {
    if (target.getTargets().size() > 0) {
      Cards cards=new CardsImpl(target.getTargets());
      player.revealCards("String_Node_Str",cards,game);
      player.moveCards(cards,Zone.LIBRARY,Zone.GRAVEYARD,source,game);
    }
    player.shuffleLibrary(source,game);
    return true;
  }
  player.shuffleLibrary(source,game);
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  UUID targetPlayerID=source.getFirstTarget();
  if (controller.searchLibrary(target,game,targetPlayerID)) {
    if (target.getTargets().size() > 0) {
      Cards cards=new CardsImpl(target.getTargets());
      controller.revealCards("String_Node_Str",cards,game);
      controller.moveCards(cards,Zone.GRAVEYARD,source,game);
    }
    controller.shuffleLibrary(source,game);
    return true;
  }
  controller.shuffleLibrary(source,game);
  return false;
}
Program: 158465
Project: 158465
Buggy source:
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  Object object=this.getValue("String_Node_Str");
  if (object instanceof Integer) {
    int amount=((Integer)object);
    new AddCountersSourceEffect(CounterType.P1P1.createInstance(amount)).apply(game,source);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean replaceEvent(GameEvent event,Ability source,Game game){
  Object object=this.getValue("String_Node_Str");
  Permanent permanent=game.getPermanentEntering(source.getSourceId());
  if (permanent != null && object instanceof Integer) {
    int amount=((Integer)object);
    permanent.addCounters(CounterType.P1P1.createInstance(amount),game);
  }
  return false;
}
Program: 158466
Project: 158466
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  MageObject sourceObject=game.getObject(source.getSourceId());
  int boost=amount.calculate(game,source,this);
  if (player != null) {
    Choice typeChoice=new ChoiceImpl(true);
    typeChoice.setMessage("String_Node_Str");
    typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
    while (!player.choose(outcome,typeChoice,game)) {
      if (!player.canRespond()) {
        return false;
      }
    }
    if (typeChoice.getChoice() != null) {
      game.informPlayers(sourceObject.getLogName() + "String_Node_Str" + typeChoice.getChoice());
    }
    FilterCreaturePermanent filterCreaturePermanent=new FilterCreaturePermanent();
    filterCreaturePermanent.add(new SubtypePredicate(typeChoice.getChoice()));
    game.addEffect(new BoostAllOfChosenSubtypeEffect(boost,boost,Duration.EndOfTurn,filterCreaturePermanent,false),source);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  MageObject sourceObject=game.getObject(source.getSourceId());
  int boost=amount.calculate(game,source,this);
  if (player != null) {
    Choice typeChoice=new ChoiceImpl(true);
    typeChoice.setMessage("String_Node_Str");
    typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
    while (!player.choose(outcome,typeChoice,game)) {
      if (!player.canRespond()) {
        return false;
      }
    }
    if (typeChoice.getChoice() != null) {
      game.informPlayers(sourceObject.getLogName() + "String_Node_Str" + typeChoice.getChoice());
    }
    FilterCreaturePermanent filterCreaturePermanent=new FilterCreaturePermanent();
    filterCreaturePermanent.add(new SubtypePredicate(typeChoice.getChoice()));
    game.addEffect(new BoostAllEffect(boost,boost,Duration.EndOfTurn,filterCreaturePermanent,false),source);
    return true;
  }
  return false;
}
Program: 158467
Project: 158467
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Permanent permanent=game.getPermanent(source.getSourceId());
  if (controller != null && permanent != null) {
    FilterCard filter=new FilterCard();
    filter.add(new SubtypePredicate("String_Node_Str"));
    filter.add(new AuraCardCanAttachToPermanentId(permanent.getId()));
    TargetCardInHand target=new TargetCardInHand(0,1,filter);
    if (controller.choose(Outcome.PutCardInPlay,target,source.getSourceId(),game)) {
      Card auraInHand=game.getCard(target.getFirstTarget());
      if (auraInHand != null) {
        game.getState().setValue("String_Node_Str" + auraInHand.getId(),permanent);
        if (controller.moveCards(auraInHand,Zone.BATTLEFIELD,source,game)) {
          permanent.addAttachment(auraInHand.getId(),game);
        }
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  FilterCard filterCardInHand=new FilterCard();
  filterCardInHand.add(new SubtypePredicate("String_Node_Str"));
  Player controller=game.getPlayer(source.getControllerId());
  Permanent academyResearchers=game.getPermanent(source.getSourceId());
  if (controller != null && academyResearchers != null) {
    filterCardInHand.add(new AuraCardCanAttachToPermanentId(academyResearchers.getId()));
    TargetCardInHand target=new TargetCardInHand(0,1,filterCardInHand);
    if (controller.choose(Outcome.PutCardInPlay,target,source.getSourceId(),game)) {
      Card auraInHand=game.getCard(target.getFirstTarget());
      if (auraInHand != null) {
        game.getState().setValue("String_Node_Str" + auraInHand.getId(),academyResearchers);
        auraInHand.putOntoBattlefield(game,Zone.HAND,source.getSourceId(),controller.getId());
        if (academyResearchers.addAttachment(auraInHand.getId(),game)) {
          game.informPlayers(controller.getLogName() + "String_Node_Str" + auraInHand.getLogName()+ "String_Node_Str"+ academyResearchers.getLogName()+ "String_Node_Str");
          return true;
        }
      }
    }
  }
  return false;
}
Program: 158468
Project: 158468
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Permanent auraPermanent=game.getPermanent(source.getSourceId());
    if (auraPermanent != null && auraPermanent.getSubtype().contains("String_Node_Str") && auraPermanent.getOwnerId().equals(source.getControllerId())) {
      Permanent enchantedPermanent=game.getPermanent(auraPermanent.getAttachedTo());
      filter.add(new AuraCardCanAttachToPermanentId(enchantedPermanent.getId()));
      TargetCardInHand target=new TargetCardInHand(0,1,filter);
      if (controller.choose(Outcome.PutCardInPlay,target,source.getSourceId(),game)) {
        Card auraInHand=game.getCard(target.getFirstTarget());
        if (auraInHand != null) {
          controller.moveCards(auraInHand,Zone.BATTLEFIELD,source,game);
          enchantedPermanent.addAttachment(auraInHand.getId(),game);
          controller.moveCards(auraPermanent,Zone.HAND,source,game);
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  FilterCard filterCardToCheck=new FilterCard();
  filterCardToCheck.add(new SubtypePredicate("String_Node_Str"));
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Permanent auraSourcePermanent=game.getPermanent(source.getSourceId());
    if (auraSourcePermanent != null && auraSourcePermanent.getSubtype().contains("String_Node_Str") && auraSourcePermanent.getOwnerId().equals(source.getControllerId())) {
      Permanent enchantedPermanent=game.getPermanent(auraSourcePermanent.getAttachedTo());
      filterCardToCheck.add(new AuraCardCanAttachToPermanentId(enchantedPermanent.getId()));
      TargetCardInHand target=new TargetCardInHand(filterCardToCheck);
      if (controller.choose(Outcome.PutCardInPlay,target,source.getSourceId(),game)) {
        Card auraInHand=game.getCard(target.getFirstTarget());
        if (auraInHand != null) {
          game.getState().setValue("String_Node_Str" + auraInHand.getId(),enchantedPermanent);
          auraInHand.putOntoBattlefield(game,Zone.HAND,source.getSourceId(),controller.getId());
          enchantedPermanent.addAttachment(auraInHand.getId(),game);
          game.informPlayers(controller.getLogName() + "String_Node_Str" + auraInHand.getLogName()+ "String_Node_Str"+ enchantedPermanent.getLogName()+ "String_Node_Str");
          enchantedPermanent.removeAttachment(auraSourcePermanent.getId(),game);
          return controller.moveCardToHandWithInfo(auraSourcePermanent,source.getSourceId(),game);
        }
      }
    }
  }
  return false;
}
Program: 158469
Project: 158469
Buggy source:
@Override public String getText(Mode mode){
  return "String_Node_Str" + filter;
}

Fixed version (ground truth):
@Override public String getText(Mode mode){
  StringBuilder sb=new StringBuilder();
  sb.append("String_Node_Str").append(filter.getMessage());
  return sb.toString();
}
Program: 158470
Project: 158470
Buggy source:
@Test public void testExileNonLandCardAndCastIt(){
  removeAllCardsFromLibrary(playerA);
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.HAND,playerA,"String_Node_Str",1);
  addCard(Zone.LIBRARY,playerA,"String_Node_Str",1);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str",playerB);
  setChoice(playerB,"String_Node_Str");
  setStopAt(1,PhaseStep.BEGIN_COMBAT);
  execute();
  assertLife(playerB,17);
  assertExileCount("String_Node_Str",1);
  assertHandCount(playerB,2);
}

Fixed version (ground truth):
@Test public void testExileNonLandCardAndCastIt(){
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.HAND,playerA,"String_Node_Str",1);
  addCard(Zone.LIBRARY,playerA,"String_Node_Str",1);
  skipInitShuffling();
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str",playerB);
  setChoice(playerB,"String_Node_Str");
  setStopAt(1,PhaseStep.BEGIN_COMBAT);
  execute();
  assertLife(playerB,17);
  assertExileCount("String_Node_Str",0);
  assertHandCount(playerB,2);
}
Program: 158471
Project: 158471
Buggy source:
@Override public Mode chooseMode(Modes modes,Ability source,Game game){
  if (!modesSet.isEmpty() && modes.getMaxModes() > modes.getSelectedModes().size()) {
    if (modesSet.get(0) == null) {
      modesSet.remove(0);
      return null;
    }
    int selectedMode=Integer.parseInt(modesSet.get(0));
    int i=1;
    for (    Mode mode : modes.getAvailableModes(source,game)) {
      if (i == selectedMode) {
        modesSet.remove(0);
        return mode;
      }
      i++;
    }
  }
  return computerPlayer.chooseMode(modes,source,game);
}

Fixed version (ground truth):
@Override public Mode chooseMode(Modes modes,Ability source,Game game){
  if (!modesSet.isEmpty() && modes.getMaxModes() > modes.getSelectedModes().size()) {
    if (modesSet.get(0) == null) {
      modesSet.remove(0);
      return null;
    }
    int selectedMode=Integer.parseInt(modesSet.get(0));
    int i=1;
    for (    Mode mode : modes.getAvailableModes(source,game)) {
      if (i == selectedMode) {
        modesSet.remove(0);
        return mode;
      }
      i++;
    }
  }
  if (modes.getMinModes() <= modes.getSelectedModes().size()) {
    return null;
  }
  return computerPlayer.chooseMode(modes,source,game);
}
Program: 158472
Project: 158472
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Player targetOpponent=game.getPlayer(getTargetPointer().getFirst(game,source));
  if (controller != null && targetOpponent != null) {
    int amount=new AttackingCreatureCount().calculate(game,source,this);
    if (amount > 0) {
      targetOpponent.loseLife(amount,game);
      controller.gainLife(amount,game);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Player targetOpponent=game.getPlayer(getTargetPointer().getFirst(game,source));
  if (controller != null && targetOpponent != null) {
    int amount=new AttackingFilterCreatureCount(filter).calculate(game,source,this);
    if (amount > 0) {
      targetOpponent.loseLife(amount,game);
      controller.gainLife(amount,game);
    }
    return true;
  }
  return false;
}
Program: 158473
Project: 158473
Buggy source:
@Override public boolean apply(Game game,Ability source){
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  MageObject sourceObject=source.getSourceObject(game);
  Player opponent=game.getPlayer(getTargetPointer().getFirst(game,source));
  if (controller != null && sourceObject != null && opponent != null) {
    if (opponent.getLibrary().size() > 0) {
      Card card=opponent.getLibrary().getFromTop(game);
      if (card != null && opponent.moveCards(card,Zone.EXILED,source,game)) {
        if (!card.getCardType().contains(CardType.LAND)) {
          if (controller.chooseUse(outcome,"String_Node_Str" + card.getLogName() + "String_Node_Str",source,game)) {
            controller.cast(card.getSpellAbility(),game,true);
          }
        }
      }
    }
    return true;
  }
  return false;
}
Program: 158474
Project: 158474
Buggy source:
@Override public MindsDilationCastFromExileEffect copy(){
  return new MindsDilationCastFromExileEffect(this);
}

Fixed version (ground truth):
@Override public MindsDilationEffect copy(){
  return new MindsDilationEffect(this);
}
Program: 158475
Project: 158475
Buggy source:
public BecomesCreatureSourceEffect(final BecomesCreatureSourceEffect effect){
  super(effect);
  this.token=effect.token.copy();
  this.type=effect.type;
  this.losePreviousTypes=effect.losePreviousTypes;
  this.power=effect.power.copy();
  this.toughness=effect.toughness.copy();
}

Fixed version (ground truth):
public BecomesCreatureSourceEffect(final BecomesCreatureSourceEffect effect){
  super(effect);
  this.token=effect.token.copy();
  this.type=effect.type;
  this.losePreviousTypes=effect.losePreviousTypes;
  if (effect.power != null) {
    this.power=effect.power.copy();
  }
  if (effect.toughness != null) {
    this.toughness=effect.toughness.copy();
  }
}
Program: 158476
Project: 158476
Buggy source:
public SpellsCastWatcher(final SpellsCastWatcher watcher){
  super(watcher);
}

Fixed version (ground truth):
public SpellsCastWatcher(final SpellsCastWatcher watcher){
  super(watcher);
  this.spellsCast.putAll(watcher.spellsCast);
}
Program: 158477
Project: 158477
Buggy source:
@Ignore @Test public void testFieldResearcherFirstEffect(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  activateAbility(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  activateAbility(3,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  activateAbility(3,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  addTarget(playerA,"String_Node_Str");
  addTarget(playerA,"String_Node_Str");
  attack(3,playerA,"String_Node_Str");
  attack(3,playerA,"String_Node_Str");
  setStopAt(3,PhaseStep.END_COMBAT);
  execute();
  assertLife(playerB,13);
  assertPermanentCount(playerA,"String_Node_Str",1);
  assertPermanentCount(playerA,"String_Node_Str",1);
  assertPermanentCount(playerA,"String_Node_Str",1);
  assertHandCount(playerA,3);
}

Fixed version (ground truth):
@Test public void testFieldResearcherFirstEffect(){
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  activateAbility(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  activateAbility(3,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  activateAbility(3,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str");
  addTarget(playerA,"String_Node_Str");
  attack(3,playerA,"String_Node_Str");
  attack(3,playerA,"String_Node_Str");
  setStopAt(3,PhaseStep.END_COMBAT);
  execute();
  assertLife(playerB,13);
  assertPermanentCount(playerA,"String_Node_Str",1);
  assertPermanentCount(playerA,"String_Node_Str",1);
  assertPermanentCount(playerA,"String_Node_Str",1);
  assertHandCount(playerA,3);
}
Program: 158478
Project: 158478
Buggy source:
public GideonChampionOfJusticeToken(){
  super("String_Node_Str","String_Node_Str");
  cardType.add(CardType.CREATURE);
  subtype.add("String_Node_Str");
  subtype.add("String_Node_Str");
  power=new MageInt(0);
  toughness=new MageInt(0);
  this.addAbility(IndestructibleAbility.getInstance());
  this.addAbility(new SimpleStaticAbility(Zone.ALL,new SetPowerToughnessSourceEffect(new CountersCount(CounterType.LOYALTY),Duration.WhileOnBattlefield)));
}

Fixed version (ground truth):
public GideonChampionOfJusticeToken(){
  super("String_Node_Str","String_Node_Str");
  cardType.add(CardType.CREATURE);
  subtype.add("String_Node_Str");
  subtype.add("String_Node_Str");
  power=new MageInt(0);
  toughness=new MageInt(0);
  this.addAbility(IndestructibleAbility.getInstance());
  CountersCount loyaltyCount=new CountersCount(CounterType.LOYALTY);
  this.addAbility(new SimpleStaticAbility(Zone.ALL,new SetPowerToughnessSourceEffect(loyaltyCount,Duration.WhileOnBattlefield)));
}
Program: 158479
Project: 158479
Buggy source:
public GideonChampionOfJusticeToken(){
  super("String_Node_Str","String_Node_Str");
  cardType.add(CardType.CREATURE);
  subtype.add("String_Node_Str");
  subtype.add("String_Node_Str");
  power=new MageInt(0);
  toughness=new MageInt(0);
  this.addAbility(IndestructibleAbility.getInstance());
  CountersCount loyaltyCount=new CountersCount(CounterType.LOYALTY);
  this.addAbility(new SimpleStaticAbility(Zone.ALL,new SetPowerToughnessSourceEffect(loyaltyCount,Duration.WhileOnBattlefield)));
}

Fixed version (ground truth):
public GideonChampionOfJusticeToken(){
  super("String_Node_Str","String_Node_Str");
  cardType.add(CardType.CREATURE);
  subtype.add("String_Node_Str");
  subtype.add("String_Node_Str");
  power=new MageInt(0);
  toughness=new MageInt(0);
  this.addAbility(IndestructibleAbility.getInstance());
}
Program: 158480
Project: 158480
Buggy source:
public BecomesCreatureSourceEffect(final BecomesCreatureSourceEffect effect){
  super(effect);
  this.token=effect.token.copy();
  this.type=effect.type;
  this.losePreviousTypes=effect.losePreviousTypes;
}

Fixed version (ground truth):
public BecomesCreatureSourceEffect(final BecomesCreatureSourceEffect effect){
  super(effect);
  this.token=effect.token.copy();
  this.type=effect.type;
  this.losePreviousTypes=effect.losePreviousTypes;
  this.power=effect.power;
  this.toughness=effect.toughness;
}
Program: 158481
Project: 158481
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
switch (sacrificingPlayer) {
case YOU:
    if (event.getPlayerId().equals(getControllerId())) {
      return false;
    }
  break;
case OPPONENT:
Player controller=game.getPlayer(getControllerId());
if (controller == null || !controller.hasOpponent(event.getPlayerId(),game)) {
return false;
}
break;
}
Permanent sacrificedPermanent=game.getPermanentOrLKIBattlefield(event.getTargetId());
return sacrificedPermanent != null && filter.match(sacrificedPermanent,getSourceId(),getControllerId(),game);
}

Fixed version (ground truth):
@Override public boolean checkTrigger(GameEvent event,Game game){
  boolean sacrificed=false;
switch (sacrificingPlayer) {
case YOU:
    if (event.getPlayerId().equals(getControllerId())) {
      sacrificed=true;
    }
  break;
case OPPONENT:
Player controller=game.getPlayer(getControllerId());
if (controller == null || !controller.hasOpponent(event.getPlayerId(),game)) {
sacrificed=true;
}
break;
}
Permanent sacrificedPermanent=game.getPermanentOrLKIBattlefield(event.getTargetId());
return sacrificed && sacrificedPermanent != null && filter.match(sacrificedPermanent,getSourceId(),getControllerId(),game);
}
Program: 158482
Project: 158482
Buggy source:
@Override public boolean checkTrigger(GameEvent event,Game game){
  UUID targetId=event.getTargetId();
  Permanent permanent=game.getPermanent(targetId);
  if (permanent.getCardType().contains(CardType.ARTIFACT)) {
    for (    Effect effect : this.getEffects()) {
      effect.setTargetPointer(new FixedTarget(this));
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@java.lang.Override public boolean checkTrigger(GameEvent event,Game game){
  UUID targetId=event.getTargetId();
  Permanent permanent=game.getPermanent(targetId);
  if (permanent.getCardType().contains(CardType.ARTIFACT)) {
    for (    Effect effect : this.getEffects()) {
      effect.setTargetPointer(new FixedTarget(permanent,game));
    }
    return true;
  }
  return false;
}
Program: 158483
Project: 158483
Buggy source:
@Override public boolean checkEventType(GameEvent event,Game game){
  return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}

Fixed version (ground truth):
@java.lang.Override public boolean checkEventType(GameEvent event,Game game){
  return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
Program: 158484
Project: 158484
Buggy source:
@Override public String getRule(){
  return "String_Node_Str";
}

Fixed version (ground truth):
@java.lang.Override public String getRule(){
  return "String_Node_Str";
}
Program: 158485
Project: 158485
Buggy source:
@Override public SerumTankTriggeredAbility copy(){
  return new SerumTankTriggeredAbility(this);
}

Fixed version (ground truth):
@java.lang.Override public SerumTankTriggeredAbility copy(){
  return new SerumTankTriggeredAbility(this);
}
Program: 158486
Project: 158486
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanent(source.getFirstTarget());
  Player controller=game.getPlayer(source.getControllerId());
  Permanent sourcePermanent=game.getPermanentOrLKIBattlefield(source.getSourceId());
  if (controller != null && permanent != null && sourcePermanent != null) {
    if (controller.moveCardToExileWithInfo(permanent,source.getSourceId(),sourcePermanent.getIdName(),source.getSourceId(),game,Zone.BATTLEFIELD,true)) {
      MageObject mageObject=game.getObject(permanent.getId());
      if (mageObject != null) {
        CopyEffect copyEffect=new CopyEffect(Duration.EndOfTurn,mageObject,source.getSourceId());
        game.addEffect(copyEffect,source);
      }
      AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility=new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(),Zone.BATTLEFIELD,false));
      delayedAbility.setSourceId(source.getSourceId());
      delayedAbility.setControllerId(source.getControllerId());
      delayedAbility.setSourceObject(source.getSourceObject(game),game);
      game.addDelayedTriggeredAbility(delayedAbility);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanent(source.getFirstTarget());
  Player controller=game.getPlayer(source.getControllerId());
  Permanent sourcePermanent=game.getPermanentOrLKIBattlefield(source.getSourceId());
  if (controller != null && permanent != null && sourcePermanent != null) {
    CopyEffect copyEffect=new CopyEffect(Duration.EndOfTurn,permanent,source.getSourceId());
    if (controller.moveCardToExileWithInfo(permanent,source.getSourceId(),sourcePermanent.getIdName(),source.getSourceId(),game,Zone.BATTLEFIELD,true)) {
      game.addEffect(copyEffect,source);
      AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility=new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(),Zone.BATTLEFIELD,false));
      delayedAbility.setSourceId(source.getSourceId());
      delayedAbility.setControllerId(source.getControllerId());
      delayedAbility.setSourceObject(source.getSourceObject(game),game);
      game.addDelayedTriggeredAbility(delayedAbility);
      return true;
    }
  }
  return false;
}
Program: 158487
Project: 158487
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Permanent permanent=game.getPermanentEntering(source.getSourceId());
  if (controller != null && permanent != null) {
    if (controller.flipCoin(game)) {
      game.informPlayers("String_Node_Str");
      game.addEffect(new SetPowerSourceEffect(new StaticValue(5),Duration.WhileOnBattlefield),source);
      game.addEffect(new SetToughnessSourceEffect(new StaticValue(2),Duration.WhileOnBattlefield),source);
      game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(),Duration.WhileOnBattlefield),source);
      return true;
    }
 else {
      game.informPlayers("String_Node_Str");
      game.addEffect(new SetPowerSourceEffect(new StaticValue(2),Duration.WhileOnBattlefield),source);
      game.addEffect(new SetToughnessSourceEffect(new StaticValue(5),Duration.WhileOnBattlefield),source);
      game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(),Duration.WhileOnBattlefield),source);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  Permanent permanent=game.getPermanentEntering(source.getSourceId());
  if (controller != null && permanent != null) {
    if (controller.flipCoin(game)) {
      game.informPlayers("String_Node_Str" + permanent.getLogName() + "String_Node_Str");
      game.addEffect(new SetPowerSourceEffect(new StaticValue(5),Duration.WhileOnBattlefield),source);
      game.addEffect(new SetToughnessSourceEffect(new StaticValue(2),Duration.WhileOnBattlefield),source);
      game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(),Duration.WhileOnBattlefield),source);
      return true;
    }
 else {
      game.informPlayers("String_Node_Str" + permanent.getLogName() + "String_Node_Str");
      game.addEffect(new SetPowerSourceEffect(new StaticValue(2),Duration.WhileOnBattlefield),source);
      game.addEffect(new SetToughnessSourceEffect(new StaticValue(5),Duration.WhileOnBattlefield),source);
      game.addEffect(new GainAbilitySourceEffect(DefenderAbility.getInstance(),Duration.WhileOnBattlefield),source);
      return true;
    }
  }
  return false;
}
Program: 158488
Project: 158488
Buggy source:
@Override public boolean apply(Game game,Ability source,Ability abilityToModify){
  int numCosts=abilityToModify.getModes().getSelectedModes().size() - 1;
  for (int i=0; i < numCosts; i++) {
    abilityToModify.addCost(cost);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source,Ability abilityToModify){
  int numCosts=abilityToModify.getModes().getSelectedModes().size() - 1;
  for (int i=0; i < numCosts; i++) {
    abilityToModify.addCost(cost.copy());
  }
  return true;
}
Program: 158489
Project: 158489
Buggy source:
@Override public BufferedImage apply(BufferedImage image){
  if (key.width != image.getWidth() || key.height != image.getHeight())   image=resizeImage(image,key.width,key.height);
  if (key.angle != 0.0)   image=rotateImage(image,key.angle);
  return image;
}

Fixed version (ground truth):
@Override public BufferedImage apply(BufferedImage image){
  if (key.width != image.getWidth() || key.height != image.getHeight()) {
    image=resizeImage(image,key.width,key.height);
  }
  if (key.angle != 0.0) {
    image=rotateImage(image,key.angle);
  }
  return image;
}