Program: 158733
Project: 158733
Buggy source:
@Override public boolean moveCards(Set<Card> cards,Zone toZone,Ability source,Game game,boolean tapped,boolean faceDown,boolean byOwner,ArrayList<UUID> appliedEffects){
  if (cards.isEmpty()) {
    return true;
  }
  Set<Card> successfulMovedCards=new LinkedHashSet<>();
  Zone fromZone=null;
switch (toZone) {
case GRAVEYARD:
    fromZone=game.getState().getZone(cards.iterator().next().getId());
  successfulMovedCards=moveCardsToGraveyardWithInfo(cards,source,game,fromZone);
break;
case BATTLEFIELD:
List<Permanent> permanents=new ArrayList<>();
List<Permanent> permanentsEntered=new ArrayList<>();
for (Card card : cards) {
UUID controllingPlayerId=byOwner ? card.getOwnerId() : getId();
fromZone=game.getState().getZone(card.getId());
if (faceDown) {
card.setFaceDown(true,game);
}
ZoneChangeEvent event=new ZoneChangeEvent(card.getId(),source.getSourceId(),controllingPlayerId,fromZone,Zone.BATTLEFIELD,appliedEffects,tapped);
if (!game.replaceEvent(event)) {
Permanent permanent=new PermanentCard(card,event.getPlayerId(),game);
permanents.add(permanent);
game.getPermanentsEntering().put(permanent.getId(),permanent);
card.checkForCountersToAdd(permanent,game);
permanent.setTapped(tapped);
permanent.setFaceDown(faceDown,game);
}
if (faceDown) {
card.setFaceDown(false,game);
}
}
game.setScopeRelevant(true);
for (Permanent permanent : permanents) {
fromZone=game.getState().getZone(permanent.getId());
if (permanent.entersBattlefield(source.getSourceId(),game,fromZone,true)) {
permanentsEntered.add(permanent);
}
 else {
game.getPermanentsEntering().remove(permanent.getId());
}
}
game.setScopeRelevant(false);
for (Permanent permanent : permanentsEntered) {
fromZone=game.getState().getZone(permanent.getId());
if (((Card)permanent).removeFromZone(game,fromZone,source.getSourceId())) {
permanent.updateZoneChangeCounter(game);
game.getContinuousEffects().setController(permanent.getId(),permanent.getControllerId());
game.addPermanent(permanent);
permanent.setZone(Zone.BATTLEFIELD,game);
game.getPermanentsEntering().remove(permanent.getId());
game.setScopeRelevant(true);
successfulMovedCards.add(permanent);
game.addSimultaneousEvent(new ZoneChangeEvent(permanent,permanent.getControllerId(),fromZone,Zone.BATTLEFIELD));
if (!game.isSimulation()) {
game.informPlayers(this.getLogName() + "String_Node_Str" + (faceDown ? "String_Node_Str" : permanent.getLogName())+ "String_Node_Str"+ fromZone.toString().toLowerCase(Locale.ENGLISH)+ "String_Node_Str");
}
}
 else {
game.getPermanentsEntering().remove(permanent.getId());
}
}
game.applyEffects();
break;
case HAND:
for (Card card : cards) {
fromZone=game.getState().getZone(card.getId());
boolean hideCard=fromZone.equals(Zone.LIBRARY) || (card.isFaceDown(game) && !fromZone.equals(Zone.STACK) && !fromZone.equals(Zone.BATTLEFIELD));
if (moveCardToHandWithInfo(card,source == null ? null : source.getSourceId(),game,!hideCard)) {
successfulMovedCards.add(card);
}
}
break;
case EXILED:
for (Card card : cards) {
fromZone=game.getState().getZone(card.getId());
boolean withName=(fromZone.equals(Zone.BATTLEFIELD) || fromZone.equals(Zone.STACK)) || !card.isFaceDown(game);
if (moveCardToExileWithInfo(card,null,"String_Node_Str",source == null ? null : source.getSourceId(),game,fromZone,withName)) {
successfulMovedCards.add(card);
}
}
break;
case LIBRARY:
for (Card card : cards) {
if (card instanceof Spell) {
fromZone=game.getState().getZone(((Spell)card).getSourceId());
}
 else {
fromZone=game.getState().getZone(card.getId());
}
boolean hideCard=fromZone.equals(Zone.HAND) || fromZone.equals(Zone.LIBRARY);
if (moveCardToLibraryWithInfo(card,source == null ? null : source.getSourceId(),game,fromZone,true,!hideCard)) {
successfulMovedCards.add(card);
}
}
break;
default :
throw new UnsupportedOperationException("String_Node_Str" + toZone.toString() + "String_Node_Str");
}
game.fireEvent(new ZoneChangeGroupEvent(successfulMovedCards,source == null ? null : source.getSourceId(),this.getId(),fromZone,toZone));
return successfulMovedCards.size() > 0;
}

Fixed version (ground truth):
@Override public boolean moveCards(Set<Card> cards,Zone toZone,Ability source,Game game,boolean tapped,boolean faceDown,boolean byOwner,ArrayList<UUID> appliedEffects){
  if (cards.isEmpty()) {
    return true;
  }
  Set<Card> successfulMovedCards=new LinkedHashSet<>();
  Zone fromZone=null;
switch (toZone) {
case GRAVEYARD:
    fromZone=game.getState().getZone(cards.iterator().next().getId());
  successfulMovedCards=moveCardsToGraveyardWithInfo(cards,source,game,fromZone);
break;
case BATTLEFIELD:
List<Permanent> permanents=new ArrayList<>();
List<Permanent> permanentsEntered=new ArrayList<>();
for (Card card : cards) {
UUID controllingPlayerId=byOwner ? card.getOwnerId() : getId();
fromZone=game.getState().getZone(card.getId());
if (faceDown) {
card.setFaceDown(true,game);
}
ZoneChangeEvent event=new ZoneChangeEvent(card.getId(),source.getSourceId(),controllingPlayerId,fromZone,Zone.BATTLEFIELD,appliedEffects,tapped);
if (!game.replaceEvent(event)) {
Permanent permanent=new PermanentCard(card,event.getPlayerId(),game);
permanents.add(permanent);
game.getPermanentsEntering().put(permanent.getId(),permanent);
card.checkForCountersToAdd(permanent,game);
permanent.setTapped(tapped);
permanent.setFaceDown(faceDown,game);
}
if (faceDown) {
card.setFaceDown(false,game);
}
}
game.setScopeRelevant(true);
for (Permanent permanent : permanents) {
fromZone=game.getState().getZone(permanent.getId());
game.getContinuousEffects().setController(permanent.getId(),permanent.getControllerId());
if (permanent.entersBattlefield(source.getSourceId(),game,fromZone,true)) {
permanentsEntered.add(permanent);
}
 else {
game.getContinuousEffects().setController(permanent.getId(),permanent.getOwnerId());
game.getPermanentsEntering().remove(permanent.getId());
}
}
game.setScopeRelevant(false);
for (Permanent permanent : permanentsEntered) {
fromZone=game.getState().getZone(permanent.getId());
if (((Card)permanent).removeFromZone(game,fromZone,source.getSourceId())) {
permanent.updateZoneChangeCounter(game);
game.addPermanent(permanent);
permanent.setZone(Zone.BATTLEFIELD,game);
game.getPermanentsEntering().remove(permanent.getId());
game.setScopeRelevant(true);
successfulMovedCards.add(permanent);
game.addSimultaneousEvent(new ZoneChangeEvent(permanent,permanent.getControllerId(),fromZone,Zone.BATTLEFIELD));
if (!game.isSimulation()) {
game.informPlayers(this.getLogName() + "String_Node_Str" + (faceDown ? "String_Node_Str" : permanent.getLogName())+ "String_Node_Str"+ fromZone.toString().toLowerCase(Locale.ENGLISH)+ "String_Node_Str");
}
}
 else {
game.getPermanentsEntering().remove(permanent.getId());
}
}
game.applyEffects();
break;
case HAND:
for (Card card : cards) {
fromZone=game.getState().getZone(card.getId());
boolean hideCard=fromZone.equals(Zone.LIBRARY) || (card.isFaceDown(game) && !fromZone.equals(Zone.STACK) && !fromZone.equals(Zone.BATTLEFIELD));
if (moveCardToHandWithInfo(card,source == null ? null : source.getSourceId(),game,!hideCard)) {
successfulMovedCards.add(card);
}
}
break;
case EXILED:
for (Card card : cards) {
fromZone=game.getState().getZone(card.getId());
boolean withName=(fromZone.equals(Zone.BATTLEFIELD) || fromZone.equals(Zone.STACK)) || !card.isFaceDown(game);
if (moveCardToExileWithInfo(card,null,"String_Node_Str",source == null ? null : source.getSourceId(),game,fromZone,withName)) {
successfulMovedCards.add(card);
}
}
break;
case LIBRARY:
for (Card card : cards) {
if (card instanceof Spell) {
fromZone=game.getState().getZone(((Spell)card).getSourceId());
}
 else {
fromZone=game.getState().getZone(card.getId());
}
boolean hideCard=fromZone.equals(Zone.HAND) || fromZone.equals(Zone.LIBRARY);
if (moveCardToLibraryWithInfo(card,source == null ? null : source.getSourceId(),game,fromZone,true,!hideCard)) {
successfulMovedCards.add(card);
}
}
break;
default :
throw new UnsupportedOperationException("String_Node_Str" + toZone.toString() + "String_Node_Str");
}
game.fireEvent(new ZoneChangeGroupEvent(successfulMovedCards,source == null ? null : source.getSourceId(),this.getId(),fromZone,toZone));
return successfulMovedCards.size() > 0;
}