nus-yam/ex-repair huggingface dataset:
Program: 159292
Project: 159292
Buggy source:
@Override public void mouseReleased(MouseEvent e,TransferData transferData){
  CardPanel card=((CardPanel)transferData.component);
  if (card.getZone() != null && card.getZone().equalsIgnoreCase("String_Node_Str")) {
    int maxXOffset=0;
    if (isDragging) {
      Point mouse=new Point(e.getX(),e.getY());
      SwingUtilities.convertPointToScreen(mouse,transferData.component);
      int xOffset=card.getXOffset(card.getCardWidth());
      maxXOffset=Math.abs((int)(mouse.getX() - initialMousePos.x) - xOffset);
    }
    clearDragging(card);
    this.startedDragging=false;
    if (maxXOffset < MIN_X_OFFSET_REQUIRED) {
      transferData.component.requestFocusInWindow();
      defaultCallback.mouseClicked(e,transferData.gameId,session,transferData.card);
      hidePopup();
    }
  }
 else {
    transferData.component.requestFocusInWindow();
    defaultCallback.mouseClicked(e,transferData.gameId,session,transferData.card);
    hidePopup();
  }
}

Fixed version (ground truth):
@Override public void mouseReleased(MouseEvent e,TransferData transferData){
  CardPanel card=((CardPanel)transferData.component);
  if (card.getZone() != null && card.getZone().equalsIgnoreCase("String_Node_Str")) {
    int maxXOffset=0;
    if (isDragging) {
      Point mouse=new Point(e.getX(),e.getY());
      SwingUtilities.convertPointToScreen(mouse,transferData.component);
      maxXOffset=Math.abs((int)(mouse.getX() - initialMousePos.x));
    }
    clearDragging(card);
    this.startedDragging=false;
    if (maxXOffset < MIN_X_OFFSET_REQUIRED) {
      transferData.component.requestFocusInWindow();
      defaultCallback.mouseClicked(e,transferData.gameId,session,transferData.card);
      hidePopup();
    }
  }
 else {
    transferData.component.requestFocusInWindow();
    defaultCallback.mouseClicked(e,transferData.gameId,session,transferData.card);
    hidePopup();
  }
}
Program: 159293
Project: 159293
Buggy source:
@Override public String generateURL(CardDownloadData card) throws Exception {
  Integer collectorId=card.getCollectorId();
  String cardSet=card.getSet();
  if (collectorId == null || cardSet == null) {
    throw new Exception("String_Node_Str" + collectorId + "String_Node_Str"+ cardSet);
  }
  StringBuilder url=new StringBuilder("String_Node_Str");
  url.append(cardSet.toUpperCase()).append("String_Node_Str");
  if (card.isSplitCard()) {
    url.append(card.getDownloadName().replaceAll("String_Node_Str","String_Node_Str"));
  }
 else {
    url.append(card.getDownloadName());
  }
  if (card.isTwoFacedCard()) {
    url.append(card.isSecondSide() ? "String_Node_Str" : "String_Node_Str");
  }
  if (card.isFlipCard()) {
    if (card.isFlippedSide()) {
      url.append("String_Node_Str");
    }
 else {
      url.append("String_Node_Str");
    }
  }
  url.append("String_Node_Str");
  return url.toString();
}

Fixed version (ground truth):
@Override public String generateURL(CardDownloadData card) throws Exception {
  Integer collectorId=card.getCollectorId();
  String cardSet=card.getSet();
  if (collectorId == null || cardSet == null) {
    throw new Exception("String_Node_Str" + collectorId + "String_Node_Str"+ cardSet);
  }
  StringBuilder url=new StringBuilder("String_Node_Str");
  url.append(cardSet.toUpperCase()).append("String_Node_Str");
  if (card.isSplitCard()) {
    url.append(card.getDownloadName().replaceAll("String_Node_Str","String_Node_Str"));
  }
 else {
    url.append(card.getDownloadName().replaceAll("String_Node_Str","String_Node_Str"));
  }
  if (card.isTwoFacedCard()) {
    url.append(card.isSecondSide() ? "String_Node_Str" : "String_Node_Str");
  }
  if (card.isFlipCard()) {
    if (card.isFlippedSide()) {
      url.append("String_Node_Str");
    }
 else {
      url.append("String_Node_Str");
    }
  }
  url.append("String_Node_Str");
  return url.toString();
}
Program: 159294
Project: 159294
Buggy source:
/** 
 * Test that if command has only one target and that targets is not valid on resolution, Cryptic Command fizzeles The player does not draw a card
 */
@Test public void testCommand(){
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",2);
  addCard(Zone.HAND,playerB,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",4);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str",playerB);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerB,"String_Node_Str","String_Node_Str");
  setModeChoice(playerB,"String_Node_Str");
  setModeChoice(playerB,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str","String_Node_Str");
  setStopAt(1,PhaseStep.CLEANUP);
  execute();
  assertLife(playerA,20);
  assertLife(playerB,20);
  assertHandCount(playerA,2);
  assertGraveyardCount(playerA,1);
  assertHandCount(playerB,0);
  assertGraveyardCount(playerB,1);
}

Fixed version (ground truth):
/** 
 * Test that if command has only one target and that targets is not valid on resolution, Cryptic Command fizzeles The player does not draw a card
 */
@Test public void testCommand(){
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.HAND,playerA,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",1);
  addCard(Zone.BATTLEFIELD,playerA,"String_Node_Str",2);
  addCard(Zone.HAND,playerB,"String_Node_Str");
  addCard(Zone.BATTLEFIELD,playerB,"String_Node_Str",4);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str",playerB);
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerB,"String_Node_Str","String_Node_Str");
  setModeChoice(playerB,"String_Node_Str");
  setModeChoice(playerB,"String_Node_Str");
  castSpell(1,PhaseStep.PRECOMBAT_MAIN,playerA,"String_Node_Str","String_Node_Str","String_Node_Str");
  setStopAt(1,PhaseStep.CLEANUP);
  execute();
  assertLife(playerA,20);
  assertLife(playerB,20);
  assertGraveyardCount(playerA,"String_Node_Str",1);
  assertGraveyardCount(playerA,1);
  assertGraveyardCount(playerB,"String_Node_Str",1);
  assertGraveyardCount(playerB,1);
  assertHandCount(playerA,2);
  assertHandCount(playerB,0);
}
Program: 159295
Project: 159295
Buggy source:
private boolean addTargets(Ability ability,String[] groups,Game game){
  boolean result=true;
  for (int i=1; i < groups.length; i++) {
    String group=groups[i];
    if (ability instanceof SpellAbility && ((SpellAbility)ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
      if (group.contains("String_Node_Str")) {
        result=handleTargetString(group.substring(group.indexOf("String_Node_Str") + 9),ability,game);
      }
 else       if (group.startsWith("String_Node_Str")) {
        result=handleTargetString(group.substring(group.indexOf("String_Node_Str") + 10),ability,game);
      }
 else {
        result=false;
      }
    }
 else {
      result=handleTargetString(group,ability,game);
    }
  }
  return result;
}

Fixed version (ground truth):
private boolean addTargets(Ability ability,String[] groups,Game game){
  boolean result=true;
  for (int i=1; i < groups.length; i++) {
    String group=groups[i];
    if (group.startsWith("String_Node_Str")) {
      break;
    }
    if (ability instanceof SpellAbility && ((SpellAbility)ability).getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) {
      if (group.contains("String_Node_Str")) {
        result=handleTargetString(group.substring(group.indexOf("String_Node_Str") + 9),ability,game);
      }
 else       if (group.startsWith("String_Node_Str")) {
        result=handleTargetString(group.substring(group.indexOf("String_Node_Str") + 10),ability,game);
      }
 else {
        result=false;
      }
    }
 else {
      result=handleTargetString(group,ability,game);
    }
  }
  return result;
}
Program: 159296
Project: 159296
Buggy source:
private void groupAttachments(JLayeredPane jLayeredPane,JLayeredPane jPanel,Map<UUID,MagePermanent> permanents,PermanentView permanent){
  MagePermanent perm=permanents.get(permanent.getId());
  if (perm == null) {
    return;
  }
  int position=jLayeredPane.getPosition(perm);
  perm.getLinks().clear();
  Rectangle r=perm.getBounds();
  if (!Plugins.getInstance().isCardPluginLoaded()) {
    for (    UUID attachmentId : permanent.getAttachments()) {
      MagePermanent link=permanents.get(attachmentId);
      if (link != null) {
        perm.getLinks().add(link);
        r.translate(20,20);
        link.setBounds(r);
        jLayeredPane.setPosition(link,++position);
      }
    }
  }
 else {
    int index=permanent.getAttachments().size();
    for (    UUID attachmentId : permanent.getAttachments()) {
      MagePermanent link=permanents.get(attachmentId);
      if (link != null) {
        link.setBounds(r);
        perm.getLinks().add(link);
        r.translate(8,10);
        perm.setBounds(r);
        jLayeredPane.moveToFront(link);
        jLayeredPane.moveToFront(perm);
        jPanel.setComponentZOrder(link,index);
        index--;
      }
    }
    jPanel.setComponentZOrder(perm,index);
  }
}

Fixed version (ground truth):
private void groupAttachments(JLayeredPane jLayeredPane,JLayeredPane jPanel,Map<UUID,MagePermanent> permanents,PermanentView permanent){
  MagePermanent perm=permanents.get(permanent.getId());
  if (perm == null) {
    return;
  }
  int position=jLayeredPane.getPosition(perm);
  perm.getLinks().clear();
  Rectangle r=perm.getBounds();
  if (!Plugins.getInstance().isCardPluginLoaded()) {
    for (    UUID attachmentId : permanent.getAttachments()) {
      MagePermanent link=permanents.get(attachmentId);
      if (link != null) {
        perm.getLinks().add(link);
        r.translate(20,20);
        link.setBounds(r);
        jLayeredPane.setPosition(link,++position);
      }
    }
  }
 else {
    int index=permanent.getAttachments().size();
    for (    UUID attachmentId : permanent.getAttachments()) {
      MagePermanent link=permanents.get(attachmentId);
      if (link != null) {
        link.setBounds(r);
        perm.getLinks().add(link);
        if (index == 1) {
          r.translate(ATTACHMENTS_DX_OFFSET,ATTACHMENT_DY_OFFSET);
        }
 else {
          r.translate(ATTACHMENT_DX_OFFSET,ATTACHMENT_DY_OFFSET);
        }
        perm.setBounds(r);
        jLayeredPane.moveToFront(link);
        jLayeredPane.moveToFront(perm);
        jPanel.setComponentZOrder(link,index);
        index--;
      }
    }
    jPanel.setComponentZOrder(perm,index);
  }
}
Program: 159297
Project: 159297
Buggy source:
private int getHeight(){
  return cardHeight + (size() - 1) * stackSpacingY + cardSpacingY;
}

Fixed version (ground truth):
private int getHeight(){
  return cardHeight + (size() - 1) * stackSpacingY + cardSpacingY + ATTACHMENT_DY_OFFSET * maxAttachedCount;
}
Program: 159299
Project: 159299
Buggy source:
public boolean isType(MagePermanent card){
switch (this) {
case land:
    return CardUtil.isLand(card);
case creature:
  return CardUtil.isCreature(card);
case other:
return !CardUtil.isLand(card) && !CardUtil.isCreature(card);
default :
throw new RuntimeException("String_Node_Str" + this);
}
}

Fixed version (ground truth):
public boolean isType(MagePermanent card){
switch (this) {
case land:
    return CardUtil.isLand(card);
case creature:
  return CardUtil.isCreature(card);
case other:
return !CardUtil.isLand(card) && !CardUtil.isCreature(card);
case attached:
return card.getOriginalPermanent().isAttachedTo();
default :
throw new RuntimeException("String_Node_Str" + this);
}
}
Program: 159302
Project: 159302
Buggy source:
public void pickBlockerOrder(UUID playerId,Game game){
  if (blockers.isEmpty()) {
    return;
  }
  Player player=game.getPlayer(playerId);
  List<UUID> blockerList=new ArrayList<>(blockers);
  blockerOrder.clear();
  while (true) {
    if (blockerList.size() == 1) {
      blockerOrder.add(blockerList.get(0));
      break;
    }
 else {
      List<Permanent> blockerPerms=new ArrayList<>();
      for (      UUID blockerId : blockerList) {
        blockerPerms.add(game.getPermanent(blockerId));
      }
      UUID blockerId=player.chooseBlockerOrder(blockerPerms,game);
      blockerOrder.add(blockerId);
      blockerList.remove(blockerId);
    }
  }
}

Fixed version (ground truth):
public void pickBlockerOrder(UUID playerId,Game game){
  if (blockers.isEmpty()) {
    return;
  }
  Player player=game.getPlayer(playerId);
  List<UUID> blockerList=new ArrayList<>(blockers);
  blockerOrder.clear();
  while (true && player.isInGame()) {
    if (blockerList.size() == 1) {
      blockerOrder.add(blockerList.get(0));
      break;
    }
 else {
      List<Permanent> blockerPerms=new ArrayList<>();
      for (      UUID blockerId : blockerList) {
        blockerPerms.add(game.getPermanent(blockerId));
      }
      UUID blockerId=player.chooseBlockerOrder(blockerPerms,game);
      blockerOrder.add(blockerId);
      blockerList.remove(blockerId);
    }
  }
}
Program: 159303
Project: 159303
Buggy source:
public synchronized boolean joinTournament(UUID userId,String name,String playerType,int skill) throws GameException {
  if (table.getState() != TableState.WAITING) {
    return false;
  }
  Seat seat=table.getNextAvailableSeat(playerType);
  if (seat == null) {
    throw new GameException("String_Node_Str");
  }
  User user=UserManager.getInstance().getUser(userId);
  if (user == null) {
    logger.fatal(new StringBuilder("String_Node_Str").append(name).append("String_Node_Str").append(userId).toString());
    return false;
  }
  if (userPlayerMap.containsKey(userId)) {
    user.showUserMessage("String_Node_Str",new StringBuilder("String_Node_Str").toString());
    return false;
  }
  Player player=createPlayer(name,seat.getPlayerType(),skill);
  if (player != null) {
    if (!player.canJoinTable(table)) {
      user.showUserMessage("String_Node_Str",new StringBuilder("String_Node_Str").append(seat.getPlayerType()).append("String_Node_Str").toString());
      return false;
    }
    tournament.addPlayer(player,seat.getPlayerType());
    table.joinTable(player,seat);
    logger.debug("String_Node_Str" + player.getId());
    if (seat.getPlayer().isHuman()) {
      user.addTable(player.getId(),table);
      user.joinedTable(table.getRoomId(),table.getId(),true);
      userPlayerMap.put(userId,player.getId());
    }
    return true;
  }
 else {
    throw new GameException("String_Node_Str" + seat.getPlayerType().toString() + "String_Node_Str");
  }
}

Fixed version (ground truth):
public synchronized boolean joinTournament(UUID userId,String name,String playerType,int skill) throws GameException {
  if (table.getState() != TableState.WAITING) {
    return false;
  }
  Seat seat=table.getNextAvailableSeat(playerType);
  if (seat == null) {
    throw new GameException("String_Node_Str");
  }
  User user=UserManager.getInstance().getUser(userId);
  if (user == null) {
    logger.fatal(new StringBuilder("String_Node_Str").append(name).append("String_Node_Str").append(userId).toString());
    return false;
  }
  if (userPlayerMap.containsKey(userId) && playerType.equals("String_Node_Str")) {
    user.showUserMessage("String_Node_Str",new StringBuilder("String_Node_Str").toString());
    return false;
  }
  Player player=createPlayer(name,seat.getPlayerType(),skill);
  if (player != null) {
    if (!player.canJoinTable(table)) {
      user.showUserMessage("String_Node_Str",new StringBuilder("String_Node_Str").append(seat.getPlayerType()).append("String_Node_Str").toString());
      return false;
    }
    tournament.addPlayer(player,seat.getPlayerType());
    table.joinTable(player,seat);
    logger.debug("String_Node_Str" + player.getId());
    if (seat.getPlayer().isHuman()) {
      user.addTable(player.getId(),table);
      user.joinedTable(table.getRoomId(),table.getId(),true);
      userPlayerMap.put(userId,player.getId());
    }
    return true;
  }
 else {
    throw new GameException("String_Node_Str" + seat.getPlayerType().toString() + "String_Node_Str");
  }
}
Program: 159306
Project: 159306
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  Player targetPlayer=game.getPlayer(source.getFirstTarget());
  if (player != null && targetPlayer != null) {
    int count=game.getBattlefield().countAll(new FilterPermanent(),targetPlayer.getId(),game);
    TargetPermanent target=new TargetPermanent(0,count,new FilterPermanent("String_Node_Str"),false);
    List<Permanent> pile1=new ArrayList<Permanent>();
    if (player.choose(Outcome.Neutral,target,source.getSourceId(),game)) {
      List<UUID> targets=target.getTargets();
      for (      UUID targetId : targets) {
        Permanent p=game.getPermanent(targetId);
        if (p != null) {
          pile1.add(p);
        }
      }
    }
    List<Permanent> pile2=new ArrayList<Permanent>();
    for (    Permanent p : game.getBattlefield().getAllActivePermanents(targetPlayer.getId())) {
      if (!pile1.contains(p)) {
        pile2.add(p);
      }
    }
    boolean choice=targetPlayer.choosePile(Outcome.DestroyPermanent,"String_Node_Str",pile1,pile2,game);
    if (choice) {
      sacrificePermanents(pile1,game,source);
    }
 else {
      sacrificePermanents(pile2,game,source);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  Player targetPlayer=game.getPlayer(source.getFirstTarget());
  if (player != null && targetPlayer != null) {
    int count=game.getBattlefield().countAll(new FilterPermanent(),targetPlayer.getId(),game);
    TargetPermanent target=new TargetPermanent(0,count,new FilterPermanent("String_Node_Str"),false);
    List<Permanent> pile1=new ArrayList<>();
    target.setRequired(false);
    if (player.choose(Outcome.Neutral,target,source.getSourceId(),game)) {
      List<UUID> targets=target.getTargets();
      for (      UUID targetId : targets) {
        Permanent p=game.getPermanent(targetId);
        if (p != null) {
          pile1.add(p);
        }
      }
    }
    List<Permanent> pile2=new ArrayList<>();
    for (    Permanent p : game.getBattlefield().getAllActivePermanents(targetPlayer.getId())) {
      if (!pile1.contains(p)) {
        pile2.add(p);
      }
    }
    boolean choice=targetPlayer.choosePile(Outcome.DestroyPermanent,"String_Node_Str",pile1,pile2,game);
    if (choice) {
      sacrificePermanents(pile1,game,source);
    }
 else {
      sacrificePermanents(pile2,game,source);
    }
    return true;
  }
  return false;
}
Program: 159311
Project: 159311
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Card card=game.getCard(source.getSourceId());
    if (card != null) {
switch (game.getState().getZone(card.getId())) {
case BATTLEFIELD:
        Permanent permanent=game.getPermanent(source.getSourceId());
      if (permanent != null) {
        controller.moveCardToHandWithInfo(card,source.getSourceId(),game,Zone.BATTLEFIELD);
      }
    break;
case GRAVEYARD:
  if (!fromBattlefieldOnly) {
    controller.moveCardToHandWithInfo(card,source.getSourceId(),game,Zone.GRAVEYARD);
  }
}
}
}
return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    Card card=game.getCard(source.getSourceId());
    if (card != null) {
switch (game.getState().getZone(card.getId())) {
case BATTLEFIELD:
        Permanent permanent=game.getPermanent(source.getSourceId());
      if (permanent != null) {
        return controller.moveCardToHandWithInfo(permanent,source.getSourceId(),game,Zone.BATTLEFIELD);
      }
    break;
case GRAVEYARD:
  if (!fromBattlefieldOnly) {
    return controller.moveCardToHandWithInfo(card,source.getSourceId(),game,Zone.GRAVEYARD);
  }
}
}
}
return false;
}
Program: 159312
Project: 159312
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    Spell spell=(Spell)game.getStack().getStackObject(source.getSourceId());
    if (spell != null) {
      if (spell.getFromZone() == Zone.GRAVEYARD) {
        target=new TargetCardInLibrary(2,new FilterCard());
      }
 else {
        target=new TargetCardInLibrary();
      }
      if (player.searchLibrary(target,game)) {
        if (target.getTargets().size() > 0) {
          for (          UUID cardId : (List<UUID>)target.getTargets()) {
            Card card=player.getLibrary().remove(cardId,game);
            if (card != null)             card.moveToZone(Zone.HAND,source.getId(),game,false);
          }
        }
      }
      player.shuffleLibrary(game);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    Spell spell=(Spell)game.getStack().getStackObject(source.getSourceId());
    if (spell != null) {
      if (spell.getFromZone() == Zone.GRAVEYARD) {
        target=new TargetCardInLibrary(2,new FilterCard());
      }
 else {
        target=new TargetCardInLibrary();
      }
      if (player.searchLibrary(target,game)) {
        if (target.getTargets().size() > 0) {
          for (          UUID cardId : (List<UUID>)target.getTargets()) {
            Card card=player.getLibrary().remove(cardId,game);
            if (card != null) {
              card.moveToZone(Zone.HAND,source.getId(),game,false);
            }
          }
        }
      }
      player.shuffleLibrary(game);
      return true;
    }
  }
  return false;
}
Program: 159314
Project: 159314
Buggy source:
public TargetCardInLibrary(final TargetCardInLibrary target){
  super(target);
  this.librarySearchLimit=target.librarySearchLimit;
}

Fixed version (ground truth):
public TargetCardInLibrary(final TargetCardInLibrary target){
  super(target);
  this.setRequired(false);
  this.librarySearchLimit=target.librarySearchLimit;
}
Program: 159315
Project: 159315
Buggy source:
@Override public void restoreState(int bookmark){
  if (!simulation) {
    if (bookmark != 0) {
      if (savedStates.contains(bookmark - 1)) {
        throw new UnsupportedOperationException("String_Node_Str" + (bookmark - 1) + "String_Node_Str");
      }
      int stateNum=savedStates.get(bookmark - 1);
      removeBookmark(bookmark);
      GameState restore=gameStates.rollback(stateNum);
      if (restore != null) {
        state.restore(restore);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void restoreState(int bookmark){
  if (!simulation) {
    if (bookmark != 0) {
      if (!savedStates.contains(bookmark - 1)) {
        throw new UnsupportedOperationException("String_Node_Str" + (bookmark - 1) + "String_Node_Str");
      }
      int stateNum=savedStates.get(bookmark - 1);
      removeBookmark(bookmark);
      GameState restore=gameStates.rollback(stateNum);
      if (restore != null) {
        state.restore(restore);
      }
    }
  }
}
Program: 159316
Project: 159316
Buggy source:
public void kill(DisconnectReason reason){
  for (  GameSession gameSession : gameSessions.values()) {
    gameSession.kill();
  }
  for (  DraftSession draftSession : draftSessions.values()) {
    draftSession.setKilled();
  }
  for (  TournamentSession tournamentSession : tournamentSessions.values()) {
    tournamentSession.setKilled();
  }
  for (  Entry<UUID,Table> entry : tables.entrySet()) {
    TableManager.getInstance().leaveTable(userId,entry.getValue().getId());
  }
  ChatManager.getInstance().removeUser(userId,reason);
}

Fixed version (ground truth):
public void kill(DisconnectReason reason){
  logger.debug("String_Node_Str");
  for (  GameSession gameSession : gameSessions.values()) {
    gameSession.kill();
  }
  logger.debug("String_Node_Str");
  for (  DraftSession draftSession : draftSessions.values()) {
    draftSession.setKilled();
  }
  logger.debug("String_Node_Str");
  for (  TournamentSession tournamentSession : tournamentSessions.values()) {
    tournamentSession.setKilled();
  }
  logger.debug("String_Node_Str");
  for (  Entry<UUID,Table> entry : tables.entrySet()) {
    TableManager.getInstance().leaveTable(userId,entry.getValue().getId());
  }
  logger.debug("String_Node_Str");
  ChatManager.getInstance().removeUser(userId,reason);
}
Program: 159317
Project: 159317
Buggy source:
/** 
 * Is the connection lost for more than 3 minutes, the user will be removed (within 3 minutes the user can reconnect)
 */
private void checkExpired(){
  try {
    callExecutor.execute(new Runnable(){
      @Override public void run(){
        logger.debug("String_Node_Str");
        Calendar expired=Calendar.getInstance();
        expired.add(Calendar.MINUTE,-3);
        List<User> usersToCheck=new ArrayList<>();
        usersToCheck.addAll(users.values());
        for (        User user : usersToCheck) {
          if (user.isExpired(expired.getTime())) {
            logger.info(new StringBuilder(user.getName()).append("String_Node_Str").append(user.getId()).append("String_Node_Str").append(user.getHost()));
            SessionManager.getInstance().getSession(user.getSessionId()).kill(DisconnectReason.SessionExpired);
          }
        }
        logger.debug("String_Node_Str");
      }
    }
);
  }
 catch (  Exception ex) {
    handleException(ex);
  }
}

Fixed version (ground truth):
/** 
 * Is the connection lost for more than 3 minutes, the user will be removed (within 3 minutes the user can reconnect)
 */
private void checkExpired(){
  try {
    callExecutor.execute(new Runnable(){
      @Override public void run(){
        logger.debug("String_Node_Str");
        Calendar expired=Calendar.getInstance();
        expired.add(Calendar.MINUTE,-3);
        List<User> usersToCheck=new ArrayList<>();
        usersToCheck.addAll(users.values());
        for (        User user : usersToCheck) {
          if (user.isExpired(expired.getTime())) {
            logger.info(new StringBuilder(user.getName()).append("String_Node_Str").append(user.getId()).append("String_Node_Str").append(user.getHost()));
            removeUser(user.getId(),DisconnectReason.SessionExpired);
          }
        }
        logger.debug("String_Node_Str");
      }
    }
);
  }
 catch (  Exception ex) {
    handleException(ex);
  }
}
Program: 159318
Project: 159318
Buggy source:
@Override public void run(){
  logger.debug("String_Node_Str");
  Calendar expired=Calendar.getInstance();
  expired.add(Calendar.MINUTE,-3);
  List<User> usersToCheck=new ArrayList<>();
  usersToCheck.addAll(users.values());
  for (  User user : usersToCheck) {
    if (user.isExpired(expired.getTime())) {
      logger.info(new StringBuilder(user.getName()).append("String_Node_Str").append(user.getId()).append("String_Node_Str").append(user.getHost()));
      SessionManager.getInstance().getSession(user.getSessionId()).kill(DisconnectReason.SessionExpired);
    }
  }
  logger.debug("String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  logger.debug("String_Node_Str");
  Calendar expired=Calendar.getInstance();
  expired.add(Calendar.MINUTE,-3);
  List<User> usersToCheck=new ArrayList<>();
  usersToCheck.addAll(users.values());
  for (  User user : usersToCheck) {
    if (user.isExpired(expired.getTime())) {
      logger.info(new StringBuilder(user.getName()).append("String_Node_Str").append(user.getId()).append("String_Node_Str").append(user.getHost()));
      removeUser(user.getId(),DisconnectReason.SessionExpired);
    }
  }
  logger.debug("String_Node_Str");
}
Program: 159319
Project: 159319
Buggy source:
public void removeUser(UUID userId,DisconnectReason reason){
  User user=users.get(userId);
  if (user != null) {
    logger.debug(new StringBuilder("String_Node_Str").append(user.getName()).append("String_Node_Str").append(userId).append("String_Node_Str").append(user.getSessionId()).append("String_Node_Str").append(reason.toString()));
    ChatManager.getInstance().removeUser(userId,reason);
    users.get(userId).kill(reason);
    users.remove(userId);
  }
 else {
    logger.warn(new StringBuilder("String_Node_Str").append(userId).append("String_Node_Str"));
  }
}

Fixed version (ground truth):
public void removeUser(UUID userId,DisconnectReason reason){
  User user=users.get(userId);
  if (user != null) {
    logger.debug(new StringBuilder("String_Node_Str").append(user.getName()).append("String_Node_Str").append(userId).append("String_Node_Str").append(user.getSessionId()).append("String_Node_Str").append(reason.toString()));
    ChatManager.getInstance().removeUser(userId,reason);
    user.kill(reason);
    users.remove(userId);
  }
 else {
    logger.warn(new StringBuilder("String_Node_Str").append(userId).append("String_Node_Str"));
  }
}
Program: 159320
Project: 159320
Buggy source:
@Override public boolean apply(Game game,Ability source){
  boolean result=false;
  for (  UUID targetId : getTargetPointer().getTargets(game,source)) {
    Card card=game.getCard(targetId);
    if (card != null) {
      Player player=game.getPlayer(source.getControllerId());
      if (player != null) {
        if (player.putOntoBattlefieldWithInfo(card,game,Zone.GRAVEYARD,source.getSourceId(),tapped)) {
          result=true;
        }
      }
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  boolean result=false;
  for (  UUID targetId : getTargetPointer().getTargets(game,source)) {
    Card card=game.getCard(targetId);
    if (card != null) {
      Player player=game.getPlayer(source.getControllerId());
      if (player != null) {
        if (player.putOntoBattlefieldWithInfo(card,game,Zone.GRAVEYARD,source.getSourceId(),tapped)) {
          Permanent permanent=game.getPermanent(source.getSourceId());
          if (permanent != null) {
            permanent.changeControllerId(source.getControllerId(),game);
            result=true;
          }
        }
      }
    }
  }
  return result;
}
Program: 159321
Project: 159321
Buggy source:
protected boolean playManaAbility(ManaAbility ability,Game game){
  if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATE_ABILITY,ability.getId(),ability.getSourceId(),playerId))) {
    int bookmark=game.bookmarkState();
    if (ability.activate(game,false)) {
      ability.resolve(game);
      if (storedBookmark == -1) {
        setStoredBookmark(bookmark);
      }
      return true;
    }
    game.restoreState(bookmark);
  }
  return false;
}

Fixed version (ground truth):
protected boolean playManaAbility(ManaAbility ability,Game game){
  if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATE_ABILITY,ability.getId(),ability.getSourceId(),playerId))) {
    int bookmark=game.bookmarkState();
    if (ability.activate(game,false)) {
      ability.resolve(game);
      if (storedBookmark == -1 || storedBookmark > bookmark) {
        setStoredBookmark(bookmark);
      }
      return true;
    }
    game.restoreState(bookmark);
  }
  return false;
}
Program: 159322
Project: 159322
Buggy source:
@Override public void declareAttacker(UUID attackerId,UUID defenderId,Game game){
  Permanent attacker=game.getPermanent(attackerId);
  if (attacker != null && attacker.canAttack(game) && attacker.getControllerId().equals(playerId)) {
    if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER,defenderId,attackerId,playerId))) {
      game.getCombat().declareAttacker(attackerId,defenderId,game);
    }
  }
}

Fixed version (ground truth):
@Override public void declareAttacker(UUID attackerId,UUID defenderId,Game game){
  setStoredBookmark(game.bookmarkState());
  Permanent attacker=game.getPermanent(attackerId);
  if (attacker != null && attacker.canAttack(game) && attacker.getControllerId().equals(playerId)) {
    if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER,defenderId,attackerId,playerId))) {
      game.getCombat().declareAttacker(attackerId,defenderId,game);
    }
  }
}
Program: 159323
Project: 159323
Buggy source:
@Override public String getRule(){
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String getRule(){
  return "String_Node_Str" + super.getRule();
}
Program: 159324
Project: 159324
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Permanent permanent=game.getPermanent(targetPointer.getFirst(game,source));
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    if (permanent != null) {
      Zone currentZone=game.getState().getZone(permanent.getId());
      if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(Zone.BATTLEFIELD))) {
        return controller.moveCardToExileWithInfo(permanent,exileId,exileZone,source.getSourceId(),game,onlyFromZone);
      }
    }
 else {
      Card card=game.getCard(targetPointer.getFirst(game,source));
      if (card != null) {
        Zone currentZone=game.getState().getZone(card.getId());
        if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(currentZone))) {
          return controller.moveCardToExileWithInfo(card,exileId,exileZone,source.getSourceId(),game,onlyFromZone);
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  if (controller != null) {
    for (    UUID targetId : getTargetPointer().getTargets(game,source)) {
      Permanent permanent=game.getPermanent(targetId);
      if (permanent != null) {
        Zone currentZone=game.getState().getZone(permanent.getId());
        if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(Zone.BATTLEFIELD))) {
          controller.moveCardToExileWithInfo(permanent,exileId,exileZone,source.getSourceId(),game,currentZone);
        }
      }
 else {
        Card card=game.getCard(targetId);
        if (card != null) {
          Zone currentZone=game.getState().getZone(card.getId());
          if (!currentZone.equals(Zone.EXILED) && (onlyFromZone == null || onlyFromZone.equals(currentZone))) {
            controller.moveCardToExileWithInfo(card,exileId,exileZone,source.getSourceId(),game,currentZone);
          }
        }
      }
    }
    return true;
  }
  return false;
}
Program: 159325
Project: 159325
Buggy source:
@Override public boolean canTarget(UUID id,Ability source,Game game){
  Card card=game.getCard(id);
  if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
    if (game.getPlayer(source.getControllerId()).hasOpponent(card.getOwnerId(),game)) {
      if (allFromOneOpponent && !targets.isEmpty()) {
        Card firstCard=game.getCard((UUID)targets.keySet().iterator().next());
        if (firstCard != null && !card.getOwnerId().equals(firstCard.getOwnerId())) {
          return false;
        }
      }
      return filter.match(card,game);
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canTarget(UUID id,Ability source,Game game){
  Card card=game.getCard(id);
  if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
    if (game.getPlayer(source.getControllerId()).hasOpponent(card.getOwnerId(),game)) {
      if (allFromOneOpponent && !targets.isEmpty()) {
        Card firstCard=game.getCard(targets.keySet().iterator().next());
        if (firstCard != null && !card.getOwnerId().equals(firstCard.getOwnerId())) {
          return false;
        }
      }
      return filter.match(card,game);
    }
  }
  return false;
}
Program: 159326
Project: 159326
Buggy source:
@Override public Set<UUID> possibleTargets(UUID sourceControllerId,Game game){
  Set<UUID> possibleTargets=new HashSet<UUID>();
  for (  UUID playerId : game.getPlayer(sourceControllerId).getInRange()) {
    Player player=game.getPlayer(playerId);
    if (player != null) {
switch (zone) {
case HAND:
        for (        Card card : player.getHand().getCards(filter,game)) {
          possibleTargets.add(card.getId());
        }
      break;
case GRAVEYARD:
    for (    Card card : player.getGraveyard().getCards(filter,game)) {
      possibleTargets.add(card.getId());
    }
  break;
case LIBRARY:
for (Card card : player.getLibrary().getUniqueCards(game)) {
  if (filter.match(card,game)) {
    possibleTargets.add(card.getId());
  }
}
break;
case EXILED:
for (Card card : game.getExile().getPermanentExile().getUniqueCards(game)) {
if (filter.match(card,player.getId(),game)) {
possibleTargets.add(card.getId());
}
}
break;
}
}
}
return possibleTargets;
}

Fixed version (ground truth):
@Override public Set<UUID> possibleTargets(UUID sourceControllerId,Game game){
  return possibleTargets(null,sourceControllerId,game);
}
Program: 159327
Project: 159327
Buggy source:
@Override public Set<UUID> possibleTargets(UUID sourceControllerId,Game game){
  Set<UUID> possibleTargets=new HashSet<UUID>();
  for (  StackObject stackObject : game.getStack()) {
    if (game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getControllerId()) && filter.match(stackObject,game)) {
      possibleTargets.add(stackObject.getId());
    }
  }
  return possibleTargets;
}

Fixed version (ground truth):
@Override public Set<UUID> possibleTargets(UUID sourceControllerId,Game game){
  Set<UUID> possibleTargets=new HashSet<>();
  for (  StackObject stackObject : game.getStack()) {
    if (game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getControllerId()) && filter.match(stackObject,game)) {
      possibleTargets.add(stackObject.getId());
    }
  }
  return possibleTargets;
}
Program: 159328
Project: 159328
Buggy source:
@Override public boolean canChoose(UUID sourceControllerId,Game game){
  int count=0;
  for (  StackObject stackObject : game.getStack()) {
    if (game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getControllerId()) && filter.match(stackObject,game)) {
      count++;
      if (count >= this.minNumberOfTargets)       return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canChoose(UUID sourceControllerId,Game game){
  int count=0;
  for (  StackObject stackObject : game.getStack()) {
    if (game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getControllerId()) && filter.match(stackObject,game)) {
      count++;
      if (count >= this.minNumberOfTargets) {
        return true;
      }
    }
  }
  return false;
}
Program: 159329
Project: 159329
Buggy source:
@Override public Set<UUID> possibleTargets(UUID sourceControllerId,Game game){
  Set<UUID> possibleTargets=new HashSet<UUID>();
  for (  StackObject stackObject : game.getStack()) {
    if (stackObject.getStackAbility() != null && (stackObject.getStackAbility() instanceof ActivatedAbility || stackObject.getStackAbility() instanceof TriggeredAbility) && game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getStackAbility().getControllerId())) {
      possibleTargets.add(stackObject.getStackAbility().getId());
    }
  }
  return possibleTargets;
}

Fixed version (ground truth):
@Override public Set<UUID> possibleTargets(UUID sourceControllerId,Game game){
  Set<UUID> possibleTargets=new HashSet<>();
  for (  StackObject stackObject : game.getStack()) {
    if (stackObject.getStackAbility() != null && (stackObject.getStackAbility() instanceof ActivatedAbility || stackObject.getStackAbility() instanceof TriggeredAbility) && game.getPlayer(sourceControllerId).getInRange().contains(stackObject.getStackAbility().getControllerId())) {
      possibleTargets.add(stackObject.getStackAbility().getId());
    }
  }
  return possibleTargets;
}
Program: 159330
Project: 159330
Buggy source:
@Override public boolean canChoose(UUID sourceId,UUID sourceControllerId,Game game){
  if (game.getPlayer(sourceControllerId).getGraveyard().count(filter,sourceId,sourceControllerId,game) >= this.minNumberOfTargets) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canChoose(UUID sourceId,UUID sourceControllerId,Game game){
  Player player=game.getPlayer(sourceControllerId);
  if (player != null) {
    int possibleTargets=0;
    for (    Card card : player.getGraveyard().getCards(filter,game)) {
      if (sourceId == null || isNotTarget() || !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET,card.getId(),sourceId,sourceControllerId))) {
        possibleTargets++;
        if (possibleTargets >= this.minNumberOfTargets) {
          return true;
        }
      }
    }
  }
  return false;
}
Program: 159331
Project: 159331
Buggy source:
@Override public Set<UUID> possibleTargets(UUID sourceControllerId,Game game){
  Set<UUID> possibleTargets=new HashSet<UUID>();
  for (  UUID playerId : game.getPlayer(sourceControllerId).getInRange()) {
    Player player=game.getPlayer(playerId);
    if (player != null && filter.match(player,game)) {
      possibleTargets.add(playerId);
    }
  }
  for (  Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(),sourceControllerId,game)) {
    if (filter.match(permanent,null,sourceControllerId,game)) {
      possibleTargets.add(permanent.getId());
    }
  }
  return possibleTargets;
}

Fixed version (ground truth):
@Override public Set<UUID> possibleTargets(UUID sourceControllerId,Game game){
  Set<UUID> possibleTargets=new HashSet<>();
  for (  UUID playerId : game.getPlayer(sourceControllerId).getInRange()) {
    Player player=game.getPlayer(playerId);
    if (player != null && filter.match(player,game)) {
      possibleTargets.add(playerId);
    }
  }
  for (  Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(),sourceControllerId,game)) {
    if (filter.match(permanent,null,sourceControllerId,game)) {
      possibleTargets.add(permanent.getId());
    }
  }
  return possibleTargets;
}
Program: 159333
Project: 159333
Buggy source:
@Override public boolean checkStateAndTriggered(){
  boolean somethingHappened=false;
  while (!isPaused() && !gameOver(null)) {
    if (!checkStateBasedActions()) {
      if (isPaused() || gameOver(null) || !checkTriggered()) {
        break;
      }
    }
    somethingHappened=true;
  }
  return somethingHappened;
}

Fixed version (ground truth):
@Override public boolean checkStateAndTriggered(){
  boolean somethingHappened=false;
  while (!isPaused() && !gameOver(null)) {
    if (!checkStateBasedActions()) {
      state.handleSimultaneousEvent(this);
      if (isPaused() || gameOver(null) || !checkTriggered()) {
        break;
      }
    }
    somethingHappened=true;
  }
  return somethingHappened;
}
Program: 159334
Project: 159334
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  MageObject sourceObject=game.getObject(source.getSourceId());
  if (controller != null && sourceObject != null) {
    TargetCardInLibrary target=new TargetCardInLibrary(0,3,new FilterCreatureCard("String_Node_Str"));
    if (controller.searchLibrary(target,game)) {
      if (target.getTargets().size() > 0) {
        Cards revealed=new CardsImpl();
        for (        UUID cardId : (List<UUID>)target.getTargets()) {
          Card card=controller.getLibrary().getCard(cardId,game);
          revealed.add(card);
        }
        controller.revealCards(sourceObject.getName(),revealed,game);
        controller.shuffleLibrary(game);
        TargetCard targetToLib=new TargetCard(Zone.PICK,new FilterCard(textTop));
        target.setRequired(true);
        while (revealed.size() > 1) {
          controller.choose(Outcome.Neutral,revealed,target,game);
          Card card=revealed.get(targetToLib.getFirstTarget(),game);
          if (card != null) {
            revealed.remove(card);
            card.moveToZone(Zone.LIBRARY,source.getSourceId(),game,true);
          }
          targetToLib.clearChosen();
        }
        if (revealed.size() == 1) {
          Card card=revealed.get(revealed.iterator().next(),game);
          card.moveToZone(Zone.LIBRARY,source.getSourceId(),game,true);
        }
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  MageObject sourceObject=game.getObject(source.getSourceId());
  if (controller != null && sourceObject != null) {
    TargetCardInLibrary target=new TargetCardInLibrary(0,3,new FilterCreatureCard("String_Node_Str"));
    if (controller.searchLibrary(target,game)) {
      if (target.getTargets().size() > 0) {
        Cards revealed=new CardsImpl();
        for (        UUID cardId : (List<UUID>)target.getTargets()) {
          Card card=controller.getLibrary().remove(cardId,game);
          revealed.add(card);
        }
        controller.revealCards(sourceObject.getName(),revealed,game);
        controller.shuffleLibrary(game);
        TargetCard targetToLib=new TargetCard(Zone.PICK,new FilterCard(textTop));
        target.setRequired(true);
        while (revealed.size() > 1 && controller.isInGame()) {
          controller.choose(Outcome.Neutral,revealed,targetToLib,game);
          Card card=revealed.get(targetToLib.getFirstTarget(),game);
          if (card != null) {
            revealed.remove(card);
            controller.moveCardToLibraryWithInfo(card,source.getSourceId(),game,Zone.LIBRARY,true,false);
          }
          targetToLib.clearChosen();
        }
        if (revealed.size() == 1) {
          Card card=revealed.get(revealed.iterator().next(),game);
          controller.moveCardToLibraryWithInfo(card,source.getSourceId(),game,Zone.LIBRARY,true,false);
        }
      }
      return true;
    }
  }
  return false;
}
Program: 159335
Project: 159335
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    int countersRemoved=0;
    for (    Cost cost : source.getCosts()) {
      if (cost instanceof SageOfHoursCost) {
        countersRemoved=((SageOfHoursCost)cost).getRemovedCounters();
      }
    }
    int turns=countersRemoved % 5;
    for (int i=0; i < turns; i++) {
      game.getState().getTurnMods().add(new TurnMod(player.getId(),false));
    }
    game.informPlayers(new StringBuilder(player.getName()).append("String_Node_Str").append(CardUtil.numberToText(turns,"String_Node_Str")).append(turns > 1 ? "String_Node_Str" : "String_Node_Str").append("String_Node_Str").toString());
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player player=game.getPlayer(source.getControllerId());
  if (player != null) {
    int countersRemoved=0;
    for (    Cost cost : source.getCosts()) {
      if (cost instanceof SageOfHoursCost) {
        countersRemoved=((SageOfHoursCost)cost).getRemovedCounters();
      }
    }
    int turns=countersRemoved / 5;
    for (int i=0; i < turns; i++) {
      game.getState().getTurnMods().add(new TurnMod(player.getId(),false));
    }
    game.informPlayers(new StringBuilder("String_Node_Str").append(countersRemoved).append("String_Node_Str").append(player.getName()).append("String_Node_Str").append(CardUtil.numberToText(turns,"String_Node_Str")).append(turns > 1 ? "String_Node_Str" : "String_Node_Str").append("String_Node_Str").toString());
    return true;
  }
  return false;
}