nus-yam/ex-repair huggingface dataset:
Program: 112740
Project: 112740
Buggy source:
public Game(PlayerModel playerModel0,PlayerModel playerModel1,ArtificialPlayer ai0,ArtificialPlayer ai1,boolean shufflePlayOrder){
  playerGoingFirst=playerModel0;
  playerGoingSecond=playerModel1;
  aiForPlayerGoingFirst=ai0;
  aiForPlayerGoingSecond=ai1;
  if (shufflePlayOrder && Math.random() > 0.5) {
    playerGoingFirst=playerModel1;
    playerGoingSecond=playerModel0;
    aiForPlayerGoingFirst=ai1;
    aiForPlayerGoingSecond=ai0;
  }
  log.debug("String_Node_Str",shufflePlayOrder);
  log.debug("String_Node_Str",playerGoingFirst.getPlayerId());
  boardModel_=new BoardModel(playerGoingFirst,playerGoingSecond);
}

Fixed version (ground truth):
public Game(PlayerModel playerModel0,PlayerModel playerModel1,ArtificialPlayer ai0,ArtificialPlayer ai1,boolean shufflePlayOrder){
  playerGoingFirst=playerModel0;
  playerGoingSecond=playerModel1;
  aiForPlayerGoingFirst=ai0;
  aiForPlayerGoingSecond=ai1;
  if (shufflePlayOrder && Math.random() > 0.5) {
    playerGoingFirst=playerModel1;
    playerGoingSecond=playerModel0;
    aiForPlayerGoingFirst=ai1;
    aiForPlayerGoingSecond=ai0;
  }
  log.debug("String_Node_Str",shufflePlayOrder);
  log.debug("String_Node_Str",playerGoingFirst.getPlayerId());
  boardModel=new BoardModel(playerGoingFirst,playerGoingSecond);
}
Program: 112741
Project: 112741
Buggy source:
public GameResult checkGameOver(int turnCount,GameRecord record){
  if (!boardModel_.isAlive(PlayerSide.CURRENT_PLAYER)) {
    PlayerModel winner=boardModel_.modelForSide(PlayerSide.WAITING_PLAYER);
    return new GameResult(playerGoingFirst.getPlayerId(),winner.getPlayerId(),turnCount + 1,record);
  }
 else   if (!boardModel_.isAlive(PlayerSide.WAITING_PLAYER)) {
    PlayerModel winner=boardModel_.modelForSide(PlayerSide.CURRENT_PLAYER);
    return new GameResult(playerGoingFirst.getPlayerId(),winner.getPlayerId(),turnCount + 1,record);
  }
  return null;
}

Fixed version (ground truth):
public GameResult checkGameOver(int turnCount,GameRecord record){
  if (!boardModel.isAlive(PlayerSide.CURRENT_PLAYER)) {
    PlayerModel winner=boardModel.modelForSide(PlayerSide.WAITING_PLAYER);
    return new GameResult(playerGoingFirst.getPlayerId(),winner.getPlayerId(),turnCount + 1,record);
  }
 else   if (!boardModel.isAlive(PlayerSide.WAITING_PLAYER)) {
    PlayerModel winner=boardModel.modelForSide(PlayerSide.CURRENT_PLAYER);
    return new GameResult(playerGoingFirst.getPlayerId(),winner.getPlayerId(),turnCount + 1,record);
  }
  return null;
}
Program: 112742
Project: 112742
Buggy source:
private GameResult playTurn(int turnCount,GameRecord record,ArtificialPlayer ai) throws HSException {
  beginTurn(boardModel_);
  GameResult gameResult;
  gameResult=checkGameOver(turnCount,record);
  if (gameResult != null)   return gameResult;
  List<HearthActionBoardPair> allMoves=playAITurn(turnCount,boardModel_,ai);
  if (allMoves.size() > 0) {
    boardModel_=allMoves.get(allMoves.size() - 1).board;
  }
  boardModel_=endTurn(boardModel_);
  record.put(turnCount + 1,PlayerSide.CURRENT_PLAYER,(BoardModel)boardModel_.deepCopy(),allMoves);
  gameResult=checkGameOver(turnCount,record);
  if (gameResult != null)   return gameResult;
  boardModel_=boardModel_.flipPlayers();
  return null;
}

Fixed version (ground truth):
private GameResult playTurn(int turnCount,GameRecord record,ArtificialPlayer ai) throws HSException {
  beginTurn(boardModel);
  GameResult gameResult;
  gameResult=checkGameOver(turnCount,record);
  if (gameResult != null)   return gameResult;
  List<HearthActionBoardPair> allMoves=playAITurn(turnCount,boardModel,ai);
  if (allMoves.size() > 0) {
    boardModel=allMoves.get(allMoves.size() - 1).board;
  }
  boardModel=endTurn(boardModel);
  record.put(turnCount + 1,PlayerSide.CURRENT_PLAYER,(BoardModel)boardModel.deepCopy(),allMoves);
  gameResult=checkGameOver(turnCount,record);
  if (gameResult != null)   return gameResult;
  boardModel=boardModel.flipPlayers();
  return null;
}
Program: 112744
Project: 112744
Buggy source:
public List<HearthActionBoardPair> playTurn(int turn,BoardModel board,int maxThinkTime) throws HSException {
  PlayerModel playerModel0=board.getCurrentPlayer();
  PlayerModel playerModel1=board.getWaitingPlayer();
  log.debug("String_Node_Str" + playerModel0.getName());
  log.debug("String_Node_Str",board);
  HearthTreeNode toRet=new HearthTreeNode(board);
  BoardStateFactoryBase factory=null;
  if (useSparseBoardStateFactory_) {
    factory=new SparseBoardStateFactory(playerModel0.getDeck(),playerModel1.getDeck(),maxThinkTime);
  }
 else {
    factory=new BoardStateFactoryBase(playerModel0.getDeck(),playerModel1.getDeck(),maxThinkTime);
  }
  HearthTreeNode allMoves=factory.doMoves(toRet,this);
  ArrayList<HearthActionBoardPair> retList=new ArrayList<HearthActionBoardPair>();
  HearthTreeNode curMove=allMoves;
  while (curMove.getChildren() != null) {
    curMove=curMove.getChildren().get(0);
    if (curMove instanceof StopNode) {
      HearthTreeNode allEffectsDone=((StopNode)curMove).finishAllEffects(playerModel0.getDeck(),playerModel1.getDeck());
      List<HearthActionBoardPair> nextMoves=this.playTurn(turn,allEffectsDone.data_,maxThinkTime);
      for (      HearthActionBoardPair actionBoard : nextMoves) {
        retList.add(actionBoard);
      }
      break;
    }
 else {
      retList.add(new HearthActionBoardPair(curMove.getAction(),curMove.data_));
    }
  }
  return retList;
}

Fixed version (ground truth):
public List<HearthActionBoardPair> playTurn(int turn,BoardModel board,int maxThinkTime) throws HSException {
  PlayerModel playerModel0=board.getCurrentPlayer();
  PlayerModel playerModel1=board.getWaitingPlayer();
  log.debug("String_Node_Str" + playerModel0.getName());
  log.debug("String_Node_Str",board);
  HearthTreeNode toRet=new HearthTreeNode(board);
  BoardStateFactoryBase factory=null;
  if (useSparseBoardStateFactory_) {
    factory=new SparseBoardStateFactory(playerModel0.getDeck(),playerModel1.getDeck(),maxThinkTime);
  }
 else {
    factory=new BoardStateFactoryBase(playerModel0.getDeck(),playerModel1.getDeck(),maxThinkTime);
  }
  HearthTreeNode allMoves=factory.doMoves(toRet,this);
  ArrayList<HearthActionBoardPair> retList=new ArrayList<HearthActionBoardPair>();
  HearthTreeNode curMove=allMoves;
  while (curMove.getChildren() != null) {
    curMove=curMove.getChildren().get(0);
    if (curMove instanceof StopNode) {
      HearthTreeNode allEffectsDone=((StopNode)curMove).finishAllEffects(playerModel0.getDeck(),playerModel1.getDeck());
      List<HearthActionBoardPair> nextMoves=this.playTurn(turn,allEffectsDone.data_,maxThinkTime);
      if (nextMoves.size() > 0) {
        for (        HearthActionBoardPair actionBoard : nextMoves) {
          retList.add(actionBoard);
        }
      }
 else {
        retList.add(new HearthActionBoardPair(allEffectsDone.getAction(),allEffectsDone.data_));
      }
      break;
    }
 else {
      retList.add(new HearthActionBoardPair(curMove.getAction(),curMove.data_));
    }
  }
  return retList;
}
Program: 112745
Project: 112745
Buggy source:
@Test public void testHeropower() throws HSException {
  Hero hero=board.data_.getCurrentPlayerHero();
  Minion target=board.data_.getCharacter(PlayerSide.CURRENT_PLAYER,0);
  HearthTreeNode ret=hero.useHeroAbility(PlayerSide.CURRENT_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(board.data_.getNumCards_hand(),0);
  assertTrue(hero.hasBeenUsed());
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),30);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),30);
  assertEquals(board.data_.getCurrentPlayerHero().getArmor(),1);
  assertEquals(board.data_.getWaitingPlayerHero().getArmor(),0);
  assertEquals(board.data_.getCurrentPlayerHero().getTotalAttack(),1);
  assertEquals(board.data_.getWaitingPlayerHero().getTotalAttack(),0);
  assertEquals(board.data_.getCurrentPlayerHero().getExtraAttackUntilTurnEnd(),1);
  assertEquals(board.data_.getWaitingPlayerHero().getExtraAttackUntilTurnEnd(),0);
}

Fixed version (ground truth):
@Test public void testHeropower() throws HSException {
  Hero hero=board.data_.getCurrentPlayerHero();
  Minion target=board.data_.getCharacter(PlayerSide.CURRENT_PLAYER,0);
  HearthTreeNode ret=hero.useHeroAbility(PlayerSide.CURRENT_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(board.data_.getNumCards_hand(),0);
}
Program: 112746
Project: 112746
Buggy source:
@Test public void testCannotTargetOpponent() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,0);
  Hero hero=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hero.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNull(ret);
  assertEquals(board.data_.getNumCards_hand(),0);
  assertEquals(board.data_.getCurrentPlayer().getMana(),8);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),30);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),30);
  assertEquals(board.data_.getCurrentPlayerHero().getArmor(),0);
  assertEquals(board.data_.getWaitingPlayerHero().getArmor(),0);
  assertEquals(board.data_.getCurrentPlayerHero().getTotalAttack(),0);
  assertEquals(board.data_.getWaitingPlayerHero().getTotalAttack(),0);
  assertEquals(board.data_.getCurrentPlayerHero().getExtraAttackUntilTurnEnd(),0);
  assertEquals(board.data_.getWaitingPlayerHero().getExtraAttackUntilTurnEnd(),0);
}

Fixed version (ground truth):
@Test public void testCannotTargetOpponent() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,0);
  Hero hero=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hero.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNull(ret);
  assertEquals(board.data_.getNumCards_hand(),0);
}
Program: 112747
Project: 112747
Buggy source:
@Test @Ignore("String_Node_Str") public void testCannotTargetMinion() throws HSException {
  Minion raidLeader=board.data_.getCharacter(PlayerSide.CURRENT_PLAYER,0);
  Hero hero=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hero.useHeroAbility(PlayerSide.CURRENT_PLAYER,raidLeader,board,deck,null);
  assertNull(ret);
  assertEquals(board.data_.getNumCards_hand(),1);
  assertEquals(board.data_.getCurrentPlayer().getMana(),8);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),30);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),30);
  assertEquals(board.data_.getCurrentPlayerHero().getArmor(),0);
  assertEquals(board.data_.getWaitingPlayerHero().getArmor(),0);
  assertEquals(board.data_.getCurrentPlayerHero().getTotalAttack(),0);
  assertEquals(board.data_.getWaitingPlayerHero().getTotalAttack(),0);
  assertEquals(board.data_.getCurrentPlayerHero().getExtraAttackUntilTurnEnd(),0);
  assertEquals(board.data_.getWaitingPlayerHero().getExtraAttackUntilTurnEnd(),0);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getAttack(),2);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),2);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),2);
}

Fixed version (ground truth):
@Test public void testCannotTargetMinion() throws HSException {
  Minion raidLeader=board.data_.getCharacter(PlayerSide.CURRENT_PLAYER,1);
  Hero hero=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hero.useHeroAbility(PlayerSide.CURRENT_PLAYER,raidLeader,board,deck,null);
  assertNull(ret);
  assertEquals(board.data_.getCurrentPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getArmor(),0);
  assertEquals(board.data_.getCurrentPlayerHero().getTotalAttack(),0);
  assertEquals(board.data_.getCurrentPlayerHero().getExtraAttackUntilTurnEnd(),0);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getAttack(),2);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),2);
}
Program: 112748
Project: 112748
Buggy source:
@Test public void testHeropower() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,0);
  Hero hunter=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hunter.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),30);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),28);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),2);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),2);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),7);
}

Fixed version (ground truth):
@Test public void testHeropower() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,0);
  Hero hunter=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hunter.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),28);
}
Program: 112749
Project: 112749
Buggy source:
@Test public void testHeropowerCannotTargetMinion() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,2);
  Hero hunter=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hunter.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNull(ret);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(board.data_.getCurrentPlayer().getMana(),8);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),30);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),30);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),2);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),2);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),7);
}

Fixed version (ground truth):
@Test public void testHeropowerCannotTargetMinion() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,2);
  Hero hunter=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hunter.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNull(ret);
  assertEquals(board.data_.getCurrentPlayer().getMana(),8);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),30);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
}
Program: 112750
Project: 112750
Buggy source:
@Test public void testHeropowerCannotTargetSelf() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.CURRENT_PLAYER,0);
  Hero hunter=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hunter.useHeroAbility(PlayerSide.CURRENT_PLAYER,target,board,deck,null);
  assertNull(ret);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(board.data_.getCurrentPlayer().getMana(),8);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),30);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),30);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),2);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),2);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),7);
}

Fixed version (ground truth):
@Test public void testHeropowerCannotTargetSelf() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.CURRENT_PLAYER,0);
  Hero hunter=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hunter.useHeroAbility(PlayerSide.CURRENT_PLAYER,target,board,deck,null);
  assertNull(ret);
  assertEquals(board.data_.getCurrentPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),30);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),30);
}
Program: 112751
Project: 112751
Buggy source:
@Test public void testHeropowerKillsMinion() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,1);
  target.setHealth((byte)1);
  Hero mage=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=mage.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getNumMinions(),1);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),30);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),30);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),5);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),7);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),4);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),6);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),6);
}

Fixed version (ground truth):
@Test public void testHeropowerKillsMinion() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,1);
  target.setHealth((byte)1);
  Hero mage=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=mage.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getNumMinions(),1);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),5);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),7);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),4);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),6);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),6);
}
Program: 112752
Project: 112752
Buggy source:
@Test public void testHeropowerAgainstOpponent() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,0);
  Hero mage=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=mage.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),30);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),29);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),5);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),5);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),4);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),6);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),4);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),6);
}

Fixed version (ground truth):
@Test public void testHeropowerAgainstOpponent() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,0);
  Hero mage=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=mage.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),29);
}
Program: 112754
Project: 112754
Buggy source:
@Test public void testHeropowerAgainstSelf() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.CURRENT_PLAYER,0);
  Hero mage=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=mage.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),29);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),30);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),5);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),5);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),4);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),6);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),4);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),6);
}

Fixed version (ground truth):
@Test public void testHeropowerAgainstSelf() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.CURRENT_PLAYER,0);
  Hero mage=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=mage.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),29);
}
Program: 112755
Project: 112755
Buggy source:
@Test public void testHeropowerAgainstMinion() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,1);
  Hero mage=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=mage.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),30);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),30);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),5);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),4);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),4);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),6);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),4);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),6);
}

Fixed version (ground truth):
@Test public void testHeropowerAgainstMinion() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,1);
  Hero mage=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=mage.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),5);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),4);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
}
Program: 112756
Project: 112756
Buggy source:
@Test public void testHeropowerAgainstOwnMinion() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.CURRENT_PLAYER,1);
  Hero mage=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=mage.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),30);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),30);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),4);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),5);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),4);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),6);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getTotalAttack(),4);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getTotalAttack(),6);
}

Fixed version (ground truth):
@Test public void testHeropowerAgainstOwnMinion() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.CURRENT_PLAYER,1);
  Hero mage=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=mage.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(board.data_.getCurrentPlayer().getMana(),6);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),4);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(0).getHealth(),5);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getMinions().get(1).getHealth(),7);
}
Program: 112757
Project: 112757
Buggy source:
@Test public void testHeropowerCannotTargetOpponent() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,0);
  Hero hunter=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hunter.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNull(ret);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(board.data_.getCurrentPlayer().getMana(),8);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getHealth(),30);
  assertEquals(board.data_.getWaitingPlayerHero().getHealth(),30);
  assertEquals(board.data_.getCurrentPlayerHero().getArmor(),0);
  assertEquals(board.data_.getWaitingPlayerHero().getArmor(),0);
}

Fixed version (ground truth):
@Test public void testHeropowerCannotTargetOpponent() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,0);
  Hero hunter=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hunter.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNull(ret);
  assertEquals(board.data_.getCurrentPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getArmor(),0);
  assertEquals(board.data_.getWaitingPlayerHero().getArmor(),0);
}
Program: 112758
Project: 112758
Buggy source:
@Test public void testHeropower() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.CURRENT_PLAYER,0);
  Hero hunter=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hunter.useHeroAbility(PlayerSide.CURRENT_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(board.data_.getCurrentPlayerHero().getArmor(),2);
  assertEquals(board.data_.getWaitingPlayerHero().getArmor(),0);
}

Fixed version (ground truth):
@Test public void testHeropower() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.CURRENT_PLAYER,0);
  Hero hunter=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hunter.useHeroAbility(PlayerSide.CURRENT_PLAYER,target,board,deck,null);
  assertNotNull(ret);
  assertEquals(board.data_.getCurrentPlayerHero().getArmor(),2);
}
Program: 112759
Project: 112759
Buggy source:
@Test public void testHeropowerCannotTargetMinion() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,2);
  Hero hunter=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hunter.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNull(ret);
  assertEquals(PlayerSide.CURRENT_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(PlayerSide.WAITING_PLAYER.getPlayer(board).getNumMinions(),2);
  assertEquals(board.data_.getCurrentPlayer().getMana(),8);
  assertEquals(board.data_.getWaitingPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getArmor(),0);
  assertEquals(board.data_.getWaitingPlayerHero().getArmor(),0);
}

Fixed version (ground truth):
@Test public void testHeropowerCannotTargetMinion() throws HSException {
  Minion target=board.data_.getCharacter(PlayerSide.WAITING_PLAYER,2);
  Hero hunter=board.data_.getCurrentPlayerHero();
  HearthTreeNode ret=hunter.useHeroAbility(PlayerSide.WAITING_PLAYER,target,board,deck,null);
  assertNull(ret);
  assertEquals(board.data_.getCurrentPlayer().getMana(),8);
  assertEquals(board.data_.getCurrentPlayerHero().getArmor(),0);
  assertEquals(board.data_.getWaitingPlayerHero().getArmor(),0);
}
Program: 112761
Project: 112761
Buggy source:
public HSCardSelectionList(){
  super();
  list_=new ImplementedCardList();
  editing_=false;
  DefaultListModel<ImplementedCard> model=new DefaultListModel<ImplementedCard>();
  cards_=list_.getCardList();
  Collections.sort(cards_);
  for (  ImplementedCard card : list_.getCardList()) {
    if (!card.isHero && card.collectible)     model.addElement(card);
  }
  this.setModel(model);
  this.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent evt){
      JList list=(JList)evt.getSource();
      int index=list.locationToIndex(evt.getPoint());
      log.debug("String_Node_Str" + index + "String_Node_Str"+ cards_.get(index).name_);
      if (editing_ && cardListPane_ != null) {
        ((SortedListModel<ImplementedCard>)cardListPane_.getModel()).addElement(cards_.get(index));
      }
      cardListPane_.repaint();
    }
  }
);
  this.setCellRenderer(new CardSelectionCellRenderer());
}

Fixed version (ground truth):
public HSCardSelectionList(){
  super();
  list_=new ImplementedCardList();
  editing_=false;
  DefaultListModel<ImplementedCard> model=new DefaultListModel<ImplementedCard>();
  cards_=new ArrayList<ImplementedCard>();
  for (  ImplementedCard card : list_.getCardList()) {
    if (!card.isHero && card.collectible)     cards_.add(card);
  }
  Collections.sort(cards_);
  for (  ImplementedCard card : cards_) {
    model.addElement(card);
  }
  this.setModel(model);
  this.addMouseListener(new MouseAdapter(){
    public void mousePressed(    MouseEvent evt){
      JList list=(JList)evt.getSource();
      int index=list.locationToIndex(evt.getPoint());
      log.debug("String_Node_Str" + index + "String_Node_Str"+ cards_.get(index).name_);
      if (editing_ && cardListPane_ != null) {
        ((SortedListModel<ImplementedCard>)cardListPane_.getModel()).addElement(cards_.get(index));
      }
      cardListPane_.repaint();
    }
  }
);
  this.setCellRenderer(new CardSelectionCellRenderer());
}
Program: 112762
Project: 112762
Buggy source:
/** 
 * Use the card on the given target
 * @param side
 * @param targetMinion
 * @param boardState The BoardState before this card has performed its action.  It will be manipulated and returned.
 * @param deckPlayer0
 * @param deckPlayer1
 * @param singleRealizationOnly
 * @return The boardState is manipulated and returned
 */
@Override protected HearthTreeNode use_core(PlayerSide side,Minion targetMinion,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1,boolean singleRealizationOnly) throws HSException {
  HearthTreeNode toRet=super.use_core(side,targetMinion,boardState,deckPlayer0,deckPlayer1,singleRealizationOnly);
  if (toRet != null) {
    int numHoundsToSummon=PlayerSide.WAITING_PLAYER.getPlayer(toRet).getNumMinions();
    if (numHoundsToSummon + PlayerSide.CURRENT_PLAYER.getPlayer(toRet).getNumMinions() > 7)     numHoundsToSummon=7 - PlayerSide.CURRENT_PLAYER.getPlayer(toRet).getNumMinions();
    for (int indx=0; indx < numHoundsToSummon; ++indx) {
      toRet=new Hound().summonMinion(PlayerSide.CURRENT_PLAYER,PlayerSide.CURRENT_PLAYER.getPlayer(toRet).getMinions().getLast(),toRet,deckPlayer0,deckPlayer1,false);
    }
  }
  return boardState;
}

Fixed version (ground truth):
/** 
 * Use the card on the given target
 * @param side
 * @param targetMinion
 * @param boardState The BoardState before this card has performed its action.  It will be manipulated and returned.
 * @param deckPlayer0
 * @param deckPlayer1
 * @param singleRealizationOnly
 * @return The boardState is manipulated and returned
 */
@Override protected HearthTreeNode use_core(PlayerSide side,Minion targetMinion,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1,boolean singleRealizationOnly) throws HSException {
  HearthTreeNode toRet=super.use_core(side,targetMinion,boardState,deckPlayer0,deckPlayer1,singleRealizationOnly);
  if (toRet != null) {
    int numHoundsToSummon=PlayerSide.WAITING_PLAYER.getPlayer(toRet).getNumMinions();
    if (numHoundsToSummon + PlayerSide.CURRENT_PLAYER.getPlayer(toRet).getNumMinions() > 7)     numHoundsToSummon=7 - PlayerSide.CURRENT_PLAYER.getPlayer(toRet).getNumMinions();
    for (int indx=0; indx < numHoundsToSummon; ++indx) {
      Minion placementTarget=PlayerSide.CURRENT_PLAYER.getPlayer(toRet).getNumMinions() > 0 ? PlayerSide.CURRENT_PLAYER.getPlayer(toRet).getMinions().getLast() : PlayerSide.CURRENT_PLAYER.getPlayer(toRet).getHero();
      toRet=new Hound().summonMinion(PlayerSide.CURRENT_PLAYER,placementTarget,toRet,deckPlayer0,deckPlayer1,false);
    }
  }
  return boardState;
}
Program: 112763
Project: 112763
Buggy source:
@Override public GameResult runSingleGame() throws IOException, HSException {
  return super.runSingleGame(ai0_,hero0_,deck0_,ai1_,hero1_,deck1_,true);
}

Fixed version (ground truth):
@Override public GameResult runSingleGame() throws IOException, HSException {
  return super.runSingleGame((ArtificialPlayer)ai0_.deepCopy(),(Hero)hero0_.deepCopy(),(Deck)deck0_.deepCopy(),(ArtificialPlayer)ai1_.deepCopy(),(Hero)hero1_.deepCopy(),(Deck)deck1_.deepCopy(),true);
}
Program: 112765
Project: 112765
Buggy source:
public HearthTreeNode perform(HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  HearthTreeNode toRet=boardState;
switch (verb_) {
case USE_CARD:
{
      Card card=boardState.data_.getCard_hand(actionPerformerPlayerSide,cardOrCharacterIndex_);
      Minion target=boardState.data_.getCharacter(targetPlayerSide,targetCharacterIndex_);
      toRet=card.useOn(targetPlayerSide,target,toRet,deckPlayer0,deckPlayer1,true);
    }
  break;
case HERO_ABILITY:
{
  Hero hero=boardState.data_.getHero(actionPerformerPlayerSide);
  Minion target=boardState.data_.getCharacter(targetPlayerSide,targetCharacterIndex_);
  toRet=hero.useHeroAbility(targetPlayerSide,target,toRet,deckPlayer0,deckPlayer1,true);
}
break;
case ATTACK:
{
Minion attacker=boardState.data_.getCharacter(actionPerformerPlayerSide,cardOrCharacterIndex_);
Minion target=boardState.data_.getCharacter(targetPlayerSide,targetCharacterIndex_);
toRet=attacker.attack(targetPlayerSide,target,toRet,deckPlayer0,deckPlayer1);
}
break;
}
return toRet;
}

Fixed version (ground truth):
public HearthTreeNode perform(HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  HearthTreeNode toRet=boardState;
switch (verb_) {
case USE_CARD:
{
      Card card=boardState.data_.getCard_hand(actionPerformerPlayerSide,cardOrCharacterIndex_);
      Minion target=boardState.data_.getCharacter(targetPlayerSide,targetCharacterIndex_);
      toRet=card.useOn(targetPlayerSide,target,toRet,deckPlayer0,deckPlayer1,true);
    }
  break;
case HERO_ABILITY:
{
  Hero hero=boardState.data_.getHero(actionPerformerPlayerSide);
  Minion target=boardState.data_.getCharacter(targetPlayerSide,targetCharacterIndex_);
  toRet=hero.useHeroAbility(targetPlayerSide,target,toRet,deckPlayer0,deckPlayer1,true);
}
break;
case ATTACK:
{
Minion attacker=boardState.data_.getCharacter(actionPerformerPlayerSide,cardOrCharacterIndex_);
Minion target=boardState.data_.getCharacter(targetPlayerSide,targetCharacterIndex_);
toRet=attacker.attack(targetPlayerSide,target,toRet,deckPlayer0,deckPlayer1);
}
break;
case UNTARGETABLE_BATTLECRY:
{
Minion minion=boardState.data_.getCharacter(actionPerformerPlayerSide,cardOrCharacterIndex_);
Minion placementTarget=boardState.data_.getCharacter(targetPlayerSide,targetCharacterIndex_);
toRet=minion.useUntargetableBattlecry(placementTarget,toRet,deckPlayer0,deckPlayer1,true);
}
case TARGETABLE_BATTLECRY:
{
Minion minion=boardState.data_.getCharacter(actionPerformerPlayerSide,cardOrCharacterIndex_);
Minion battlecryTarget=boardState.data_.getCharacter(targetPlayerSide,targetCharacterIndex_);
toRet=minion.useTargetableBattlecry(targetPlayerSide,battlecryTarget,toRet,deckPlayer0,deckPlayer1);
}
}
return toRet;
}
Program: 112766
Project: 112766
Buggy source:
@Override public HearthTreeNode finishAllEffects(Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  for (int i=0; i < numCardsToDraw_; ++i)   this.drawCard(deckPlayer0);
  return new HearthTreeNode(this.data_,this.score_,this.depth_,this.children_,this.numNodesTried_);
}

Fixed version (ground truth):
@Override public HearthTreeNode finishAllEffects(Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  for (int i=0; i < numCardsToDraw_; ++i)   this.drawCard(deckPlayer0);
  return new HearthTreeNode(this.data_,this.action,this.score_,this.depth_,this.children_,this.numNodesTried_);
}
Program: 112767
Project: 112767
Buggy source:
public HearthTreeNode(BoardModel data,double score,byte depth,List<HearthTreeNode> children,int numNodesTried){
  data_=data;
  score_=score;
  children_=children;
  depth_=depth;
  numNodesTried_=numNodesTried;
}

Fixed version (ground truth):
public HearthTreeNode(BoardModel data,HearthAction action,double score,byte depth,List<HearthTreeNode> children,int numNodesTried){
  data_=data;
  this.action=action;
  score_=score;
  children_=children;
  depth_=depth;
  numNodesTried_=numNodesTried;
}
Program: 112768
Project: 112768
Buggy source:
@Override public HearthTreeNode finishAllEffects(Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  return action_.perform(new HearthTreeNode(this.data_,this.score_,this.depth_,this.children_,this.numNodesTried_),deckPlayer0,deckPlayer1);
}

Fixed version (ground truth):
@Override public HearthTreeNode finishAllEffects(Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  return action_.perform(new HearthTreeNode(this.data_,this.action,this.score_,this.depth_,this.children_,this.numNodesTried_),deckPlayer0,deckPlayer1);
}
Program: 112769
Project: 112769
Buggy source:
public StopNode(HearthTreeNode origNode){
  super(origNode.data_,origNode.score_,origNode.depth_);
  children_=origNode.children_;
  numNodesTried_=origNode.numNodesTried_;
}

Fixed version (ground truth):
public StopNode(HearthTreeNode origNode){
  super(origNode.data_,origNode.action,origNode.score_,origNode.depth_);
  children_=origNode.children_;
  numNodesTried_=origNode.numNodesTried_;
}
Program: 112770
Project: 112770
Buggy source:
/** 
 * Override for battlecry Battlecry: Give adjacent minions +1/+1 and Taunt
 * @param side
 * @param boardState The BoardState before this card has performed its action.  It will be manipulated and returned.
 * @return The boardState is manipulated and returned
 */
@Override public HearthTreeNode use_core(PlayerSide side,Minion targetMinion,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1,boolean singleRealizationOnly) throws HSException {
  HearthTreeNode toRet=super.use_core(side,targetMinion,boardState,deckPlayer0,deckPlayer1,singleRealizationOnly);
  if (toRet != null) {
    int thisMinionIndex=toRet.data_.getMinions(side).indexOf(this);
    int numMinions=side.getPlayer(boardState).getNumMinions();
    if (numMinions > 1) {
      int minionToTheLeft=thisMinionIndex > 0 ? thisMinionIndex - 1 : -1;
      int minionToTheRight=thisMinionIndex < numMinions - 1 ? thisMinionIndex - 1 : -1;
      if (minionToTheLeft >= 0) {
        Minion minionToBuff=toRet.data_.getMinion(side,minionToTheLeft);
        minionToBuff.setAttack((byte)(minionToBuff.getAttack() + 1));
        minionToBuff.setHealth((byte)(minionToBuff.getHealth() + 1));
        minionToBuff.setTaunt(true);
      }
      if (minionToTheRight >= 0) {
        Minion minionToBuff=toRet.data_.getMinion(side,minionToTheRight);
        minionToBuff.setAttack((byte)(minionToBuff.getAttack() + 1));
        minionToBuff.setHealth((byte)(minionToBuff.getHealth() + 1));
        minionToBuff.setTaunt(true);
      }
    }
  }
  return toRet;
}

Fixed version (ground truth):
/** 
 * Override for battlecry Battlecry: Give adjacent minions +1/+1 and Taunt
 * @param side
 * @param boardState The BoardState before this card has performed its action.  It will be manipulated and returned.
 * @return The boardState is manipulated and returned
 */
@Override public HearthTreeNode use_core(PlayerSide side,Minion targetMinion,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1,boolean singleRealizationOnly) throws HSException {
  HearthTreeNode toRet=super.use_core(side,targetMinion,boardState,deckPlayer0,deckPlayer1,singleRealizationOnly);
  if (toRet != null) {
    int thisMinionIndex=toRet.data_.getMinions(side).indexOf(this);
    int numMinions=side.getPlayer(boardState).getNumMinions();
    if (numMinions > 1) {
      int minionToTheLeft=thisMinionIndex > 0 ? thisMinionIndex - 1 : -1;
      int minionToTheRight=thisMinionIndex < numMinions - 1 ? thisMinionIndex + 1 : -1;
      if (minionToTheLeft >= 0) {
        Minion minionToBuff=toRet.data_.getMinion(side,minionToTheLeft);
        minionToBuff.setAttack((byte)(minionToBuff.getAttack() + 1));
        minionToBuff.setHealth((byte)(minionToBuff.getHealth() + 1));
        minionToBuff.setTaunt(true);
      }
      if (minionToTheRight >= 0) {
        Minion minionToBuff=toRet.data_.getMinion(side,minionToTheRight);
        minionToBuff.setAttack((byte)(minionToBuff.getAttack() + 1));
        minionToBuff.setHealth((byte)(minionToBuff.getHealth() + 1));
        minionToBuff.setTaunt(true);
      }
    }
  }
  return toRet;
}
Program: 112771
Project: 112771
Buggy source:
public GameResult checkGameOver(int turnCount,GameRecord record){
  if (!boardModel_.isAlive_p0()) {
    return new GameResult(s0_,s1_,turnCount + 1,record);
  }
 else   if (!boardModel_.isAlive_p1()) {
    return new GameResult(s0_,s0_,turnCount + 1,record);
  }
  return null;
}

Fixed version (ground truth):
public GameResult checkGameOver(int turnCount,int activePlayerIndex,GameRecord record){
  int inactivePlayerIndex=(activePlayerIndex + 1) % 2;
  if (!boardModel_.isAlive_p0()) {
    return new GameResult(s0_,inactivePlayerIndex,turnCount + 1,record);
  }
 else   if (!boardModel_.isAlive_p1()) {
    return new GameResult(s0_,activePlayerIndex,turnCount + 1,record);
  }
  return null;
}
Program: 112772
Project: 112772
Buggy source:
private GameResult playTurn(int turnCount,GameRecord record,int activePlayerIndex,ArtificialPlayer ai) throws HSException {
  beginTurn(turnCount,boardModel_);
  GameResult gameResult;
  gameResult=checkGameOver(turnCount,record);
  if (gameResult != null)   return gameResult;
  boardModel_=playAITurn(turnCount,boardModel_,ai);
  endTurn(boardModel_);
  record.put(turnCount + 1,activePlayerIndex,(BoardModel)boardModel_.deepCopy());
  gameResult=checkGameOver(turnCount,record);
  if (gameResult != null)   return gameResult;
  boardModel_=boardModel_.flipPlayers();
  return null;
}

Fixed version (ground truth):
private GameResult playTurn(int turnCount,GameRecord record,int activePlayerIndex,ArtificialPlayer ai) throws HSException {
  beginTurn(turnCount,boardModel_);
  GameResult gameResult;
  gameResult=checkGameOver(turnCount,activePlayerIndex,record);
  if (gameResult != null)   return gameResult;
  boardModel_=playAITurn(turnCount,boardModel_,ai);
  endTurn(boardModel_);
  record.put(turnCount + 1,activePlayerIndex,(BoardModel)boardModel_.deepCopy());
  gameResult=checkGameOver(turnCount,activePlayerIndex,record);
  if (gameResult != null)   return gameResult;
  boardModel_=boardModel_.flipPlayers();
  return null;
}