nus-yam/ex-repair huggingface dataset:
Program: 112773
Project: 112773
Buggy source:
public BoardModel flipPlayers(){
  BoardModel newState=(BoardModel)this.deepCopy();
  MinionList p0_minions=newState.getMinions_p0();
  MinionList p1_minions=newState.getMinions_p1();
  int p0_mana=newState.getMana_p0();
  int p1_mana=newState.getMana_p1();
  int p0_maxMana=newState.getMaxMana_p0();
  int p1_maxMana=newState.getMaxMana_p1();
  newState.currentPlayer=waitingPlayer;
  newState.waitingPlayer=currentPlayer;
  newState.p0_hero_=p1_hero_;
  newState.p1_hero_=p0_hero_;
  newState.setMinions_p0(p1_minions);
  newState.setMinions_p1(p0_minions);
  newState.setMana_p0(p1_mana);
  newState.setMana_p1(p0_mana);
  newState.setMaxMana_p0(p1_maxMana);
  newState.setMaxMana_p1(p0_maxMana);
  newState.p0_hand_=p1_hand_;
  newState.p1_hand_=p0_hand_;
  newState.p0_deckPos_=p1_deckPos_;
  newState.p1_deckPos_=p0_deckPos_;
  newState.p0_fatigueDamage_=p1_fatigueDamage_;
  newState.p1_fatigueDamage_=p0_fatigueDamage_;
  newState.p0_spellDamage_=p1_spellDamage_;
  newState.p1_spellDamage_=p0_spellDamage_;
  for (  MinionPlayerIDPair minionIdPair : newState.allMinionsFIFOList_) {
    minionIdPair.playerIndex_=minionIdPair.playerIndex_ == 0 ? 1 : 0;
  }
  return newState;
}

Fixed version (ground truth):
public BoardModel flipPlayers(){
  BoardModel newState=(BoardModel)this.deepCopy();
  MinionList p0_minions=newState.getMinions_p0();
  MinionList p1_minions=newState.getMinions_p1();
  int p0_mana=newState.getMana_p0();
  int p1_mana=newState.getMana_p1();
  int p0_maxMana=newState.getMaxMana_p0();
  int p1_maxMana=newState.getMaxMana_p1();
  newState.currentPlayer=waitingPlayer;
  newState.waitingPlayer=currentPlayer;
  newState.playerModel0=playerModel1;
  newState.playerModel1=playerModel0;
  newState.p0_hero_=p1_hero_;
  newState.p1_hero_=p0_hero_;
  newState.setMinions_p0(p1_minions);
  newState.setMinions_p1(p0_minions);
  newState.setMana_p0(p1_mana);
  newState.setMana_p1(p0_mana);
  newState.setMaxMana_p0(p1_maxMana);
  newState.setMaxMana_p1(p0_maxMana);
  newState.p0_hand_=p1_hand_;
  newState.p1_hand_=p0_hand_;
  newState.p0_deckPos_=p1_deckPos_;
  newState.p1_deckPos_=p0_deckPos_;
  newState.p0_fatigueDamage_=p1_fatigueDamage_;
  newState.p1_fatigueDamage_=p0_fatigueDamage_;
  newState.p0_spellDamage_=p1_spellDamage_;
  newState.p1_spellDamage_=p0_spellDamage_;
  for (  MinionPlayerIDPair minionIdPair : newState.allMinionsFIFOList_) {
    minionIdPair.playerIndex_=minionIdPair.playerIndex_ == 0 ? 1 : 0;
  }
  return newState;
}
Program: 112774
Project: 112774
Buggy source:
public GameResult runGame() throws HSException {
  curTurn_=0;
  boardModel_.placeCardHandCurrentPlayer(0);
  boardModel_.placeCardHandCurrentPlayer(1);
  boardModel_.placeCardHandCurrentPlayer(2);
  boardModel_.setDeckPos_p0(3);
  boardModel_.placeCardHandWaitingPlayer(0);
  boardModel_.placeCardHandWaitingPlayer(1);
  boardModel_.placeCardHandWaitingPlayer(2);
  boardModel_.placeCardHandWaitingPlayer(3);
  boardModel_.placeCardHandWaitingPlayer(new TheCoin());
  boardModel_.setDeckPos_p1(4);
  GameRecord record=new GameSimpleRecord();
  record.put(0,PlayerSide.CURRENT_PLAYER,(BoardModel)boardModel_.deepCopy());
  record.put(0,PlayerSide.WAITING_PLAYER,(BoardModel)boardModel_.flipPlayers().deepCopy());
  GameResult gameResult;
  for (int turnCount=0; turnCount < maxTurns_; ++turnCount) {
    log.info("String_Node_Str" + turnCount);
    long turnStart=System.currentTimeMillis();
    gameResult=playTurn(turnCount,record,ais[s0_]);
    if (gameResult != null)     return gameResult;
    gameResult=playTurn(turnCount,record,ais[s1_]);
    if (gameResult != null)     return gameResult;
    long turnEnd=System.currentTimeMillis();
    long turnDelta=turnEnd - turnStart;
    if (turnDelta > ArtificialPlayer.MAX_THINK_TIME / 2) {
      log.warn("String_Node_Str",turnDelta,ArtificialPlayer.MAX_THINK_TIME);
    }
 else {
      log.debug("String_Node_Str",turnDelta);
    }
  }
  return new GameResult(s0_,-1,0,record);
}

Fixed version (ground truth):
public GameResult runGame() throws HSException {
  curTurn_=0;
  boardModel_.placeCardHandCurrentPlayer(0);
  boardModel_.placeCardHandCurrentPlayer(1);
  boardModel_.placeCardHandCurrentPlayer(2);
  boardModel_.setDeckPos_p0(3);
  boardModel_.placeCardHandWaitingPlayer(0);
  boardModel_.placeCardHandWaitingPlayer(1);
  boardModel_.placeCardHandWaitingPlayer(2);
  boardModel_.placeCardHandWaitingPlayer(3);
  boardModel_.placeCardHandWaitingPlayer(new TheCoin());
  boardModel_.setDeckPos_p1(4);
  GameRecord record=new GameSimpleRecord();
  record.put(0,PlayerSide.CURRENT_PLAYER,(BoardModel)boardModel_.deepCopy());
  record.put(0,PlayerSide.CURRENT_PLAYER,(BoardModel)boardModel_.flipPlayers().deepCopy());
  GameResult gameResult;
  for (int turnCount=0; turnCount < maxTurns_; ++turnCount) {
    log.info("String_Node_Str" + turnCount);
    long turnStart=System.currentTimeMillis();
    gameResult=playTurn(turnCount,record,aiForPlayerGoingFirst);
    if (gameResult != null)     return gameResult;
    gameResult=playTurn(turnCount,record,aiForPlayerGoingSecond);
    if (gameResult != null)     return gameResult;
    long turnEnd=System.currentTimeMillis();
    long turnDelta=turnEnd - turnStart;
    if (turnDelta > ArtificialPlayer.MAX_THINK_TIME / 2) {
      log.warn("String_Node_Str",turnDelta,ArtificialPlayer.MAX_THINK_TIME);
    }
 else {
      log.debug("String_Node_Str",turnDelta);
    }
  }
  return new GameResult(playerGoingFirst.getPlayerId(),-1,0,record);
}
Program: 112775
Project: 112775
Buggy source:
public Game(PlayerModel playerModel0,PlayerModel playerModel1,ArtificialPlayer ai0,ArtificialPlayer ai1,boolean shufflePlayOrder){
  s0_=0;
  s1_=1;
  firstPlayerIndex=0;
  secondPlayerIndex=1;
  PlayerModel firstPlayer=playerModel0;
  if (shufflePlayOrder && Math.random() > 0.5) {
    s0_=1;
    s1_=0;
    firstPlayerIndex=1;
    secondPlayerIndex=0;
    firstPlayer=playerModel1;
  }
  log.debug("String_Node_Str",shufflePlayOrder);
  log.debug("String_Node_Str",s0_);
  boardModel_=new BoardModel(playerModel0,playerModel1,firstPlayer);
  boardModel_.getCurrentPlayer().setFirstPlayer(true);
  boardModel_.getWaitingPlayer().setFirstPlayer(false);
  this.ais=new ArtificialPlayer[2];
  this.ais[0]=ai0;
  this.ais[1]=ai1;
}

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: 112776
Project: 112776
Buggy source:
public GameResult checkGameOver(int turnCount,GameRecord record){
  if (!boardModel_.isAlive(PlayerSide.CURRENT_PLAYER)) {
    PlayerModel winner=boardModel_.modelForSide(PlayerSide.WAITING_PLAYER);
    if (winner.isFirstPlayer()) {
      return new GameResult(s0_,firstPlayerIndex,turnCount + 1,record);
    }
 else {
      return new GameResult(s0_,secondPlayerIndex,turnCount + 1,record);
    }
  }
 else   if (!boardModel_.isAlive(PlayerSide.WAITING_PLAYER)) {
    PlayerModel winner=boardModel_.modelForSide(PlayerSide.CURRENT_PLAYER);
    if (winner.isFirstPlayer()) {
      return new GameResult(s0_,firstPlayerIndex,turnCount + 1,record);
    }
 else {
      return new GameResult(s0_,secondPlayerIndex,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: 112777
Project: 112777
Buggy source:
/** 
 * Run a single game
 * @param ai0 AI for player 0
 * @param hero0 Hero class for player 0
 * @param deck0 Deck for player 0
 * @param ai1 AI for player 1
 * @param hero1 Hero class for player 1
 * @param deck1 Deck for player 1
 * @param shufflePlayOrder Randomizes the play order if set to true
 * @return
 * @throws HSException
 */
protected GameResult runSingleGame(ArtificialPlayer ai0,Hero hero0,Deck deck0,ArtificialPlayer ai1,Hero hero1,Deck deck1,boolean shufflePlayOrder) throws HSException {
  deck0.shuffle();
  deck1.shuffle();
  PlayerModel playerModel0=new PlayerModel("String_Node_Str",hero0,deck0);
  PlayerModel playerModel1=new PlayerModel("String_Node_Str",hero1,deck1);
  Game game=new Game(playerModel0,playerModel1,ai0,ai1,shufflePlayOrder);
  return game.runGame();
}

Fixed version (ground truth):
/** 
 * Run a single game
 * @param ai0 AI for player 0
 * @param hero0 Hero class for player 0
 * @param deck0 Deck for player 0
 * @param ai1 AI for player 1
 * @param hero1 Hero class for player 1
 * @param deck1 Deck for player 1
 * @param shufflePlayOrder Randomizes the play order if set to true
 * @return
 * @throws HSException
 */
protected GameResult runSingleGame(ArtificialPlayer ai0,Hero hero0,Deck deck0,ArtificialPlayer ai1,Hero hero1,Deck deck1,boolean shufflePlayOrder) throws HSException {
  deck0.shuffle();
  deck1.shuffle();
  PlayerModel playerModel0=new PlayerModel(0,"String_Node_Str",hero0,deck0);
  PlayerModel playerModel1=new PlayerModel(1,"String_Node_Str",hero1,deck1);
  Game game=new Game(playerModel0,playerModel1,ai0,ai1,shufflePlayOrder);
  return game.runGame();
}
Program: 112778
Project: 112778
Buggy source:
public BoardModel(Hero p0_hero,Hero p1_hero){
  this.currentPlayer=new PlayerModel("String_Node_Str",p0_hero,null);
  this.waitingPlayer=new PlayerModel("String_Node_Str",p1_hero,null);
  buildModel();
}

Fixed version (ground truth):
public BoardModel(Hero p0_hero,Hero p1_hero){
  this.currentPlayer=new PlayerModel(0,"String_Node_Str",p0_hero,null);
  this.waitingPlayer=new PlayerModel(0,"String_Node_Str",p1_hero,null);
  buildModel();
}
Program: 112779
Project: 112779
Buggy source:
@Override public Object deepCopy(){
  PlayerModel copiedPlayerModel=new PlayerModel(this.name,(Hero)this.hero.deepCopy(),this.deck);
  copiedPlayerModel.setMana(mana);
  copiedPlayerModel.setOverload(overload);
  copiedPlayerModel.setFirstPlayer(isFirstPlayer);
  for (  Minion minion : minions) {
    copiedPlayerModel.getMinions().add((Minion)(minion).deepCopy());
  }
  copiedPlayerModel.setSpellDamage(spellDamage);
  for (  final Card card : hand) {
    Card tc=(Card)card.deepCopy();
    copiedPlayerModel.placeCardHand(tc);
  }
  return copiedPlayerModel;
}

Fixed version (ground truth):
@Override public Object deepCopy(){
  PlayerModel copiedPlayerModel=new PlayerModel(this.playerId,this.name,(Hero)this.hero.deepCopy(),this.deck);
  copiedPlayerModel.setMana(mana);
  copiedPlayerModel.setOverload(overload);
  for (  Minion minion : minions) {
    copiedPlayerModel.getMinions().add((Minion)(minion).deepCopy());
  }
  copiedPlayerModel.setSpellDamage(spellDamage);
  for (  final Card card : hand) {
    Card tc=(Card)card.deepCopy();
    copiedPlayerModel.placeCardHand(tc);
  }
  return copiedPlayerModel;
}
Program: 112780
Project: 112780
Buggy source:
public PlayerModel(String name,Hero hero,Deck deck){
  this.name=name;
  this.hero=hero;
  this.deck=deck;
  this.minions=new MinionList();
  this.hand=new IdentityLinkedList<>();
}

Fixed version (ground truth):
public PlayerModel(int playerId,String name,Hero hero,Deck deck){
  this.playerId=playerId;
  this.name=name;
  this.hero=hero;
  this.deck=deck;
  this.minions=new MinionList();
  this.hand=new IdentityLinkedList<>();
}
Program: 112781
Project: 112781
Buggy source:
@Override public int getNumCardsInHand(int playerIndex,int turn,int activePlayerIndex){
  try {
    BoardModel boardModel=boards_.get(activePlayerIndex).get(turn);
    PlayerSide playerByIndex=boardModel.getPlayerByIndex(playerIndex);
    PlayerSide otherPlayer=playerByIndex.getOtherPlayer();
    return boardModel.getNumCards_hand(otherPlayer);
  }
 catch (  HSInvalidPlayerIndexException e) {
    return 0;
  }
}

Fixed version (ground truth):
@Override public int getNumCardsInHand(int playerId,int turn,int currentPlayerId){
  try {
    BoardModel boardModel=boards_.get(currentPlayerId).get(turn);
    PlayerSide playerByIndex=boardModel.getPlayerByIndex(playerId);
    PlayerSide otherPlayer=playerByIndex.getOtherPlayer();
    return boardModel.getNumCards_hand(otherPlayer);
  }
 catch (  HSInvalidPlayerIndexException e) {
    return 0;
  }
}
Program: 112782
Project: 112782
Buggy source:
@Override public int getHeroArmor(int playerIndex,int turn,int activePlayerIndex){
  try {
    BoardModel boardModel=boards_.get(activePlayerIndex).get(turn);
    PlayerSide playerByIndex=boardModel.getPlayerByIndex(playerIndex);
    PlayerSide otherPlayer=playerByIndex.getOtherPlayer();
    return boardModel.getHero(otherPlayer).getArmor();
  }
 catch (  HSInvalidPlayerIndexException e) {
    return 0;
  }
}

Fixed version (ground truth):
@Override public int getHeroArmor(int playerId,int turn,int currentPlayerId){
  try {
    BoardModel boardModel=boards_.get(currentPlayerId).get(turn);
    PlayerSide playerByIndex=boardModel.getPlayerByIndex(playerId);
    PlayerSide otherPlayer=playerByIndex.getOtherPlayer();
    return boardModel.getHero(otherPlayer).getArmor();
  }
 catch (  HSInvalidPlayerIndexException e) {
    return 0;
  }
}
Program: 112783
Project: 112783
Buggy source:
@Override public int getHeroHealth(int playerIndex,int turn,int activePlayerIndex){
  try {
    BoardModel boardModel=boards_.get(activePlayerIndex).get(turn);
    PlayerSide playerByIndex=boardModel.getPlayerByIndex(playerIndex);
    PlayerSide otherPlayer=playerByIndex.getOtherPlayer();
    return boardModel.getHero(otherPlayer).getHealth();
  }
 catch (  HSInvalidPlayerIndexException e) {
    return 0;
  }
}

Fixed version (ground truth):
@Override public int getHeroHealth(int playerId,int turn,int currentPlayerId){
  try {
    BoardModel boardModel=boards_.get(currentPlayerId).get(turn);
    PlayerSide playerByIndex=boardModel.getPlayerByIndex(playerId);
    PlayerSide otherPlayer=playerByIndex.getOtherPlayer();
    return boardModel.getHero(otherPlayer).getHealth();
  }
 catch (  HSInvalidPlayerIndexException e) {
    return 0;
  }
}
Program: 112784
Project: 112784
Buggy source:
@Override public int getRecordLength(int playerID){
  return boards_.get(playerID).size();
}

Fixed version (ground truth):
@Override public int getRecordLength(int playerId){
  return boards_.get(playerId).size();
}
Program: 112785
Project: 112785
Buggy source:
@Override public int getNumMinions(int playerIndex,int turn,int activePlayerIndex){
  BoardModel boardModel=boards_.get(activePlayerIndex).get(turn);
  PlayerSide playerByIndex=boardModel.getPlayerByIndex(playerIndex);
  PlayerSide otherPlayer=playerByIndex.getOtherPlayer();
  return otherPlayer.getPlayer(boardModel).getNumMinions();
}

Fixed version (ground truth):
@Override public int getNumMinions(int playerId,int turn,int currentPlayerId){
  BoardModel boardModel=boards_.get(currentPlayerId).get(turn);
  PlayerSide playerByIndex=boardModel.getPlayerByIndex(playerId);
  PlayerSide otherPlayer=playerByIndex.getOtherPlayer();
  return otherPlayer.getPlayer(boardModel).getNumMinions();
}
Program: 112786
Project: 112786
Buggy source:
/** 
 * Returns the number of cards in the hand of a given player
 * @param playerIndex The index of the player for which to return the data
 * @param turn Turn number
 * @param activePlayerIndex The index of the player that just played a turn
 * @return
 */
public int getNumCardsInHand(int playerIndex,int turn,int activePlayerIndex);

Fixed version (ground truth):
/** 
 * Returns the number of cards in the hand of a given player
 * @param playerId The id of the player for which to return the data
 * @param turn Turn number
 * @param currentPlayerId The id of the player that just played a turn
 * @return
 */
public int getNumCardsInHand(int playerId,int turn,int currentPlayerId);
Program: 112787
Project: 112787
Buggy source:
/** 
 * Get the armor of a given player's hero
 * @param playerIndex The index of the player for which to return the data
 * @param turn Turn number
 * @param activePlayerIndex The index of the player that just played a turn
 * @return
 */
public int getHeroArmor(int playerIndex,int turn,int activePlayerIndex);

Fixed version (ground truth):
/** 
 * Get the armor of a given player's hero
 * @param playerId The id of the player for which to return the data
 * @param turn Turn number
 * @param currentPlayerId The id of the player that just played a turn
 * @return
 */
public int getHeroArmor(int playerId,int turn,int currentPlayerId);
Program: 112788
Project: 112788
Buggy source:
/** 
 * Get the health of a given player's hero
 * @param playerIndex The index of the player for which to return the data
 * @param turn Turn number
 * @param activePlayerIndex The index of the player that just played a turn
 * @return
 */
public int getHeroHealth(int playerIndex,int turn,int activePlayerIndex);

Fixed version (ground truth):
/** 
 * Get the health of a given player's hero
 * @param playerId The id of the player for which to return the data
 * @param turn Turn number
 * @param currentPlayerId The id of the player that just played a turn
 * @return
 */
public int getHeroHealth(int playerId,int turn,int currentPlayerId);
Program: 112789
Project: 112789
Buggy source:
/** 
 * Returns the number of minions on a player's board
 * @param playerIndex The index of the player for which to return the data
 * @param turn Turn number
 * @param activePlayerIndex The index of the player that just played a turn
 * @return
 */
public int getNumMinions(int playerIndex,int turn,int activePlayerIndex);

Fixed version (ground truth):
/** 
 * Returns the number of minions on a player's board
 * @param playerId The id of the player for which to return the data
 * @param turn Turn number
 * @param currentPlayerId The id of the player that just played a turn
 * @return
 */
public int getNumMinions(int playerId,int turn,int currentPlayerId);
Program: 112791
Project: 112791
Buggy source:
public GameResult runGame() throws HSException {
  curTurn_=0;
  curPlayer_=0;
  boardModel_.placeCard_hand_p0(0);
  boardModel_.placeCard_hand_p0(1);
  boardModel_.placeCard_hand_p0(2);
  boardModel_.setDeckPos_p0(3);
  boardModel_.placeCard_hand_p1(0);
  boardModel_.placeCard_hand_p1(1);
  boardModel_.placeCard_hand_p1(2);
  boardModel_.placeCard_hand_p1(3);
  boardModel_.placeCard_hand_p1(new TheCoin());
  boardModel_.setDeckPos_p1(4);
  GameRecord record=new GameSimpleRecord();
  record.put(0,s0_,(BoardModel)boardModel_.deepCopy());
  record.put(0,s1_,(BoardModel)boardModel_.flipPlayers().deepCopy());
  GameResult gameResult;
  for (int turnCount=0; turnCount < maxTurns_; ++turnCount) {
    log.info("String_Node_Str" + turnCount);
    long turnStart=System.currentTimeMillis();
    gameResult=playTurn(turnCount,record,ais[s0_]);
    if (gameResult != null)     return gameResult;
    gameResult=playTurn(turnCount,record,ais[s1_]);
    if (gameResult != null)     return gameResult;
    long turnEnd=System.currentTimeMillis();
    long turnDelta=turnEnd - turnStart;
    if (turnDelta > ArtificialPlayer.MAX_THINK_TIME / 2) {
      log.warn("String_Node_Str",turnDelta);
    }
 else {
      log.debug("String_Node_Str",turnDelta);
    }
  }
  return new GameResult(s0_,-1,0,record);
}

Fixed version (ground truth):
public GameResult runGame() throws HSException {
  curTurn_=0;
  curPlayer_=0;
  boardModel_.placeCard_hand_p0(0);
  boardModel_.placeCard_hand_p0(1);
  boardModel_.placeCard_hand_p0(2);
  boardModel_.setDeckPos_p0(3);
  boardModel_.placeCard_hand_p1(0);
  boardModel_.placeCard_hand_p1(1);
  boardModel_.placeCard_hand_p1(2);
  boardModel_.placeCard_hand_p1(3);
  boardModel_.placeCard_hand_p1(new TheCoin());
  boardModel_.setDeckPos_p1(4);
  GameRecord record=new GameSimpleRecord();
  record.put(0,s0_,(BoardModel)boardModel_.deepCopy());
  record.put(0,s1_,(BoardModel)boardModel_.flipPlayers().deepCopy());
  GameResult gameResult;
  for (int turnCount=0; turnCount < maxTurns_; ++turnCount) {
    log.info("String_Node_Str" + turnCount);
    long turnStart=System.currentTimeMillis();
    gameResult=playTurn(turnCount,record,s0_,ais[s0_]);
    if (gameResult != null)     return gameResult;
    gameResult=playTurn(turnCount,record,s1_,ais[s1_]);
    if (gameResult != null)     return gameResult;
    long turnEnd=System.currentTimeMillis();
    long turnDelta=turnEnd - turnStart;
    if (turnDelta > ArtificialPlayer.MAX_THINK_TIME / 2) {
      log.warn("String_Node_Str",turnDelta);
    }
 else {
      log.debug("String_Node_Str",turnDelta);
    }
  }
  return new GameResult(s0_,-1,0,record);
}
Program: 112792
Project: 112792
Buggy source:
private GameResult playTurn(int turnCount,GameRecord record,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,s0_,(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,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;
}
Program: 112794
Project: 112794
Buggy source:
/** 
 * Use the card on the given target Deals 2 damage to a minion.  If the target minion survives, draw a card. 
 * @param thisCardIndex The index (position) of the card in the hand
 * @param playerIndex The index of the target player.  0 if targeting yourself or your own minions, 1 if targeting the enemy
 * @param minionIndex The index of the target minion.
 * @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 protected HearthTreeNode use_core(int targetPlayerIndex,Minion targetMinion,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1,boolean singleRealizationOnly) throws HSException {
  if (targetMinion instanceof Hero)   return null;
  HearthTreeNode toRet=super.use_core(targetPlayerIndex,targetMinion,boardState,deckPlayer0,deckPlayer1,singleRealizationOnly);
  if (toRet != null) {
    if (targetMinion.getTotalHealth() > 0) {
      if (toRet instanceof CardDrawNode) {
        ((CardDrawNode)toRet).addNumCardsToDraw(1);
      }
 else {
        toRet=new CardDrawNode(toRet,1);
      }
    }
  }
  return toRet;
}

Fixed version (ground truth):
/** 
 * Use the card on the given target Deals 2 damage to a minion.  If the target minion survives, draw a card. 
 * @param thisCardIndex The index (position) of the card in the hand
 * @param playerIndex The index of the target player.  0 if targeting yourself or your own minions, 1 if targeting the enemy
 * @param minionIndex The index of the target minion.
 * @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 protected HearthTreeNode use_core(int targetPlayerIndex,Minion targetMinion,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1,boolean singleRealizationOnly) throws HSException {
  if (targetMinion instanceof Hero)   return null;
  HearthTreeNode toRet=super.use_core(targetPlayerIndex,targetMinion,boardState,deckPlayer0,deckPlayer1,singleRealizationOnly);
  if (toRet != null && targetMinion.getTotalHealth() > 0) {
    if (toRet instanceof CardDrawNode) {
      ((CardDrawNode)toRet).addNumCardsToDraw(1);
    }
 else {
      toRet=new CardDrawNode(toRet,1);
    }
  }
  return toRet;
}
Program: 112795
Project: 112795
Buggy source:
/** 
 * Called at the end of a turn
 */
@Override public BoardState endTurn(int thisMinionPlayerIndex,BoardState boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  BoardState tmpState=super.endTurn(thisMinionPlayerIndex,boardState,deckPlayer0,deckPlayer1);
  if (thisMinionPlayerIndex > 0)   return tmpState;
  HearthTreeNode toRet=new HearthTreeNode(tmpState);
  for (  Minion minion : toRet.data_.getMinions_p0()) {
    toRet=minion.takeHeal((byte)2,0,toRet,deckPlayer0,deckPlayer1);
  }
  for (  Minion minion : toRet.data_.getMinions_p1()) {
    toRet=minion.takeHeal((byte)2,1,toRet,deckPlayer0,deckPlayer1);
  }
  if (toRet instanceof CardDrawNode) {
    toRet=((CardDrawNode)toRet).finishAllEffects(deckPlayer0,deckPlayer1);
  }
  return toRet.data_;
}

Fixed version (ground truth):
/** 
 * Called at the end of a turn At the end of your turn, restore 1 Health to all friendly minions
 */
@Override public BoardState endTurn(int thisMinionPlayerIndex,BoardState boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  BoardState tmpState=super.endTurn(thisMinionPlayerIndex,boardState,deckPlayer0,deckPlayer1);
  if (thisMinionPlayerIndex > 0)   return tmpState;
  HearthTreeNode toRet=new HearthTreeNode(tmpState);
  for (  Minion minion : toRet.data_.getMinions_p0()) {
    toRet=minion.takeHeal((byte)1,0,toRet,deckPlayer0,deckPlayer1);
  }
  if (toRet instanceof CardDrawNode) {
    toRet=((CardDrawNode)toRet).finishAllEffects(deckPlayer0,deckPlayer1);
  }
  return toRet.data_;
}
Program: 112797
Project: 112797
Buggy source:
/** 
 * Use the hero ability on a given target Warlock: draw a card and take 2 damage
 * @param targetPlayerIndex The player index of the target character
 * @param targetMinion The target minion
 * @param boardState
 * @param deckPlayer0
 * @param deckPlayer1
 * @return
 */
@Override public HearthTreeNode useHeroAbility_core(int targetPlayerIndex,Minion targetMinion,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  if (targetPlayerIndex != 0 || !(targetMinion instanceof Hero))   return null;
  HearthTreeNode toRet=targetMinion.takeDamage((byte)2,0,0,boardState,deckPlayer0,deckPlayer1,false,false);
  if (toRet != null) {
    toRet=new CardDrawNode(toRet,1);
  }
  return toRet;
}

Fixed version (ground truth):
/** 
 * Use the hero ability on a given target Warlock: draw a card and take 2 damage
 * @param targetPlayerIndex The player index of the target character
 * @param targetMinion The target minion
 * @param boardState
 * @param deckPlayer0
 * @param deckPlayer1
 * @return
 */
@Override public HearthTreeNode useHeroAbility_core(int targetPlayerIndex,Minion targetMinion,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  if (targetPlayerIndex != 0 || !(targetMinion instanceof Hero))   return null;
  HearthTreeNode toRet=targetMinion.takeDamage((byte)2,0,0,boardState,deckPlayer0,deckPlayer1,false,false);
  if (toRet != null) {
    if (toRet instanceof CardDrawNode) {
      ((CardDrawNode)toRet).addNumCardsToDraw(1);
    }
 else {
      toRet=new CardDrawNode(toRet,1);
    }
  }
  return toRet;
}
Program: 112798
Project: 112798
Buggy source:
public double cardDrawScore(Deck deck,ArtificialPlayer ai){
  int numCardsInDeck=deck.getNumCards();
  int numCardsRemaining=numCardsInDeck - data_.getDeckPos_p0();
  int numCardsToActuallyDraw=numCardsToDraw_;
  int totalFatigueDamage=0;
  if (numCardsRemaining < numCardsToDraw_) {
    int fatigueDamage=data_.getFatigueDamage_p0();
    for (int i=0; i < numCardsToDraw_ - numCardsRemaining; ++i) {
      totalFatigueDamage+=fatigueDamage;
      fatigueDamage+=1;
    }
    numCardsToActuallyDraw=numCardsRemaining;
  }
  double averageCardScore=0.0;
  for (int indx=data_.getDeckPos_p0(); indx < numCardsInDeck; ++indx) {
    averageCardScore+=ai.cardInHandScore(deck.drawCard(indx));
  }
  averageCardScore/=numCardsRemaining;
  double toRet=averageCardScore * numCardsToActuallyDraw;
  int heroHealth=data_.getHero_p0().getHealth();
  int heroArmor=data_.getHero_p0().getArmor();
  int armorLeft=heroArmor > totalFatigueDamage ? heroArmor - totalFatigueDamage : 0;
  int healthLeft=armorLeft > 0 ? heroHealth : heroHealth - (totalFatigueDamage - heroArmor);
  toRet+=ai.heroHealthScore_p0(healthLeft,armorLeft) - ai.heroHealthScore_p0(heroHealth,heroArmor);
  double depthPenalty=1.e-4 * depth_;
  toRet-=depthPenalty;
  return toRet;
}

Fixed version (ground truth):
public double cardDrawScore(Deck deck,ArtificialPlayer ai){
  int numCardsInDeck=deck.getNumCards();
  int numCardsRemaining=numCardsInDeck - data_.getDeckPos_p0();
  int numCardsToActuallyDraw=numCardsToDraw_;
  int totalFatigueDamage=0;
  if (numCardsRemaining < numCardsToDraw_) {
    int fatigueDamage=data_.getFatigueDamage_p0();
    for (int i=0; i < numCardsToDraw_ - numCardsRemaining; ++i) {
      totalFatigueDamage+=fatigueDamage;
      fatigueDamage+=1;
    }
    numCardsToActuallyDraw=numCardsRemaining;
  }
  double averageCardScore=0.0;
  for (int indx=data_.getDeckPos_p0(); indx < numCardsInDeck; ++indx) {
    averageCardScore+=ai.cardInHandScore(deck.drawCard(indx));
  }
  averageCardScore=numCardsRemaining <= 0 ? 0.0 : averageCardScore / numCardsRemaining;
  double toRet=averageCardScore * numCardsToActuallyDraw;
  int heroHealth=data_.getHero_p0().getHealth();
  int heroArmor=data_.getHero_p0().getArmor();
  int armorLeft=heroArmor > totalFatigueDamage ? heroArmor - totalFatigueDamage : 0;
  int healthLeft=armorLeft > 0 ? heroHealth : heroHealth - (totalFatigueDamage - heroArmor);
  toRet+=ai.heroHealthScore_p0(healthLeft,armorLeft) - ai.heroHealthScore_p0(heroHealth,heroArmor);
  double depthPenalty=1.e-4 * depth_;
  toRet-=depthPenalty;
  return toRet;
}
Program: 112799
Project: 112799
Buggy source:
@Before public void setup(){
  board=new HearthTreeNode(new BoardState(new Warlock(),new Hero()));
  Minion minion0_0=new BoulderfistOgre();
  Minion minion0_1=new RaidLeader();
  Minion minion1_0=new BoulderfistOgre();
  Minion minion1_1=new RaidLeader();
  board.data_.placeCard_hand_p0(minion0_0);
  board.data_.placeCard_hand_p0(minion0_1);
  board.data_.placeCard_hand_p1(minion1_0);
  board.data_.placeCard_hand_p1(minion1_1);
  Card cards[]=new Card[10];
  for (int index=0; index < 10; ++index) {
    cards[index]=new TheCoin();
  }
  deck=new Deck(cards);
  Card fb=new WildGrowth();
  board.data_.placeCard_hand_p0(fb);
  board.data_.setMana_p0((byte)8);
  board.data_.setMana_p1((byte)8);
  board.data_.setMaxMana_p0((byte)8);
  board.data_.setMaxMana_p1((byte)8);
  HearthTreeNode tmpBoard=new HearthTreeNode(board.data_.flipPlayers());
  try {
    tmpBoard.data_.getCard_hand_p0(0).useOn(0,tmpBoard.data_.getHero_p0(),tmpBoard,deck,null);
    tmpBoard.data_.getCard_hand_p0(0).useOn(0,tmpBoard.data_.getHero_p0(),tmpBoard,deck,null);
  }
 catch (  HSException e) {
    e.printStackTrace();
  }
  board=new HearthTreeNode(tmpBoard.data_.flipPlayers());
  try {
    board.data_.getCard_hand_p0(0).useOn(0,board.data_.getHero_p0(),board,deck,null);
    board.data_.getCard_hand_p0(0).useOn(0,board.data_.getHero_p0(),board,deck,null);
  }
 catch (  HSException e) {
    e.printStackTrace();
  }
  board.data_.resetMana();
  board.data_.resetMinions();
}

Fixed version (ground truth):
@Before public void setup(){
  board=new HearthTreeNode(new BoardState(new Warlock(),new Hero()));
  Minion minion0_0=new BoulderfistOgre();
  Minion minion0_1=new RaidLeader();
  Minion minion1_0=new BoulderfistOgre();
  Minion minion1_1=new RaidLeader();
  board.data_.placeCard_hand_p0(minion0_0);
  board.data_.placeCard_hand_p0(minion0_1);
  board.data_.placeCard_hand_p1(minion1_0);
  board.data_.placeCard_hand_p1(minion1_1);
  Card cards[]=new Card[30];
  for (int index=0; index < 30; ++index) {
    cards[index]=new TheCoin();
  }
  deck=new Deck(cards);
  Card fb=new WildGrowth();
  board.data_.placeCard_hand_p0(fb);
  board.data_.setMana_p0((byte)8);
  board.data_.setMana_p1((byte)8);
  board.data_.setMaxMana_p0((byte)8);
  board.data_.setMaxMana_p1((byte)8);
  HearthTreeNode tmpBoard=new HearthTreeNode(board.data_.flipPlayers());
  try {
    tmpBoard.data_.getCard_hand_p0(0).useOn(0,tmpBoard.data_.getHero_p0(),tmpBoard,deck,null);
    tmpBoard.data_.getCard_hand_p0(0).useOn(0,tmpBoard.data_.getHero_p0(),tmpBoard,deck,null);
  }
 catch (  HSException e) {
    e.printStackTrace();
  }
  board=new HearthTreeNode(tmpBoard.data_.flipPlayers());
  try {
    board.data_.getCard_hand_p0(0).useOn(0,board.data_.getHero_p0(),board,deck,null);
    board.data_.getCard_hand_p0(0).useOn(0,board.data_.getHero_p0(),board,deck,null);
  }
 catch (  HSException e) {
    e.printStackTrace();
  }
  board.data_.resetMana();
  board.data_.resetMinions();
}
Program: 112803
Project: 112803
Buggy source:
/** 
 * Places a minion on the board via a summon effect This function is meant to be used when summoning minions through means other than a direct card usage.
 * @param targetPlayerIndex The index of the target player.  0 if targeting yourself or your own minions, 1 if targeting the enemy
 * @param targetMinion The target minion (can be a Hero).  The new minion is always placed to the right of (higher index) the target minion.  If the target minion is a hero, then it is placed at the left-most position.
 * @param boardState The BoardState before this card has performed its action.  It will be manipulated and returned.
 * @param deckPlayer0 The deck of player0
 * @param deckPlayer0 The deck of player1
 * @return The boardState is manipulated and returned
 * @throws HSException 
 */
protected HearthTreeNode summonMinion_core(int targetPlayerIndex,Minion targetMinion,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  if (boardState.data_.getNumMinions_p0() < 7) {
    if (!charge_) {
      hasAttacked_=true;
    }
    hasBeenUsed_=true;
    if (targetMinion instanceof Hero)     boardState.data_.placeMinion(targetPlayerIndex,this,0);
 else     boardState.data_.placeMinion(targetPlayerIndex,this,boardState.data_.getMinions(targetPlayerIndex).indexOf(targetMinion) + 1);
    return boardState;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Places a minion on the board via a summon effect This function is meant to be used when summoning minions through means other than a direct card usage.
 * @param targetPlayerIndex The index of the target player.  0 if targeting yourself or your own minions, 1 if targeting the enemy
 * @param targetMinion The target minion (can be a Hero).  The new minion is always placed to the right of (higher index) the target minion.  If the target minion is a hero, then it is placed at the left-most position.
 * @param boardState The BoardState before this card has performed its action.  It will be manipulated and returned.
 * @param deckPlayer0 The deck of player0
 * @param deckPlayer0 The deck of player1
 * @return The boardState is manipulated and returned
 * @throws HSException 
 */
protected HearthTreeNode summonMinion_core(int targetPlayerIndex,Minion targetMinion,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  if (boardState.data_.getNumMinions(targetPlayerIndex) < 7) {
    if (!charge_) {
      hasAttacked_=true;
    }
    hasBeenUsed_=true;
    if (targetMinion instanceof Hero)     boardState.data_.placeMinion(targetPlayerIndex,this,0);
 else     boardState.data_.placeMinion(targetPlayerIndex,this,boardState.data_.getMinions(targetPlayerIndex).indexOf(targetMinion) + 1);
    return boardState;
  }
 else {
    return null;
  }
}
Program: 112805
Project: 112805
Buggy source:
@Override public HearthTreeNode performAction(Minion minion,int thisPlayerIndex,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  HearthTreeNode toRet=super.performAction(minion,thisPlayerIndex,boardState,deckPlayer0,deckPlayer1);
  if (toRet != null) {
    toRet=toRet.data_.getHero_p1().takeDamage(damage_,(thisPlayerIndex + 1) % 2,thisPlayerIndex,boardState,deckPlayer0,deckPlayer1);
  }
  return toRet;
}

Fixed version (ground truth):
@Override public HearthTreeNode performAction(Minion minion,int thisPlayerIndex,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  HearthTreeNode toRet=super.performAction(minion,thisPlayerIndex,boardState,deckPlayer0,deckPlayer1);
  if (toRet != null) {
    toRet=toRet.data_.getHero_p1().takeDamage(damage_,(thisPlayerIndex + 1) % 2,thisPlayerIndex,toRet,deckPlayer0,deckPlayer1);
  }
  return toRet;
}
Program: 112806
Project: 112806
Buggy source:
@Override public HearthTreeNode performAction(Minion minion,int thisPlayerIndex,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  HearthTreeNode toRet=super.performAction(minion,thisPlayerIndex,boardState,deckPlayer0,deckPlayer1);
  for (int index=0; index < numMinions_; ++index) {
    try {
      Minion newMinion=(Minion)minionClass_.newInstance();
      toRet=newMinion.summonMinion(thisPlayerIndex,minion,toRet,deckPlayer0,deckPlayer1,false);
    }
 catch (    InstantiationException|IllegalAccessException e) {
      throw new HSException();
    }
  }
  return toRet;
}

Fixed version (ground truth):
@Override public HearthTreeNode performAction(Minion minion,int thisPlayerIndex,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  HearthTreeNode toRet=super.performAction(minion,thisPlayerIndex,boardState,deckPlayer0,deckPlayer1);
  for (int index=0; index < numMinions_; ++index) {
    try {
      Minion newMinion=(Minion)minionClass_.newInstance();
      Minion placementTarget=toRet.data_.getCharacter(thisPlayerIndex,toRet.data_.getMinions(thisPlayerIndex).indexOf(minion));
      toRet.data_.removeMinion(thisPlayerIndex,minion);
      toRet=newMinion.summonMinion(thisPlayerIndex,placementTarget,toRet,deckPlayer0,deckPlayer1,false);
    }
 catch (    InstantiationException|IllegalAccessException e) {
      throw new HSException();
    }
  }
  return toRet;
}
Program: 112807
Project: 112807
Buggy source:
public DeathrattleSummonMinionAction(Class minionClass,int numMnions){
  numMinions_=numMnions;
  minionClass_=minionClass;
}

Fixed version (ground truth):
public DeathrattleSummonMinionAction(Class<?> minionClass,int numMnions){
  numMinions_=numMnions;
  minionClass_=minionClass;
}
Program: 112808
Project: 112808
Buggy source:
/** 
 * Override for battlecry Battlecry: Change an enemy minion's attack to 1
 * @param thisCardIndex The index (position) of the card in the hand
 * @param playerIndex The index of the target player.  0 if targeting yourself or your own minions, 1 if targeting the enemy
 * @param minionIndex The index of the target minion.
 * @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(int targetPlayerIndex,Minion targetMinion,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  HearthTreeNode toRet=super.use_core(targetPlayerIndex,targetMinion,boardState,deckPlayer0,deckPlayer1);
  if (toRet != null) {
    for (int index=0; index < toRet.data_.getNumMinions_p1(); ++index) {
      if (index != toRet.data_.getMinions_p1().indexOf(this)) {
        HearthTreeNode newState=toRet.addChild(new HearthTreeNode((BoardState)toRet.data_.deepCopy()));
        newState.data_.getMinion_p0(index).setAttack((byte)1);
      }
    }
    return toRet;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Override for battlecry Battlecry: Change an enemy minion's attack to 1
 * @param thisCardIndex The index (position) of the card in the hand
 * @param playerIndex The index of the target player.  0 if targeting yourself or your own minions, 1 if targeting the enemy
 * @param minionIndex The index of the target minion.
 * @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(int targetPlayerIndex,Minion targetMinion,HearthTreeNode boardState,Deck deckPlayer0,Deck deckPlayer1) throws HSException {
  HearthTreeNode toRet=super.use_core(targetPlayerIndex,targetMinion,boardState,deckPlayer0,deckPlayer1);
  if (toRet != null) {
    for (int index=0; index < toRet.data_.getNumMinions_p1(); ++index) {
      if (index != toRet.data_.getMinions_p1().indexOf(this)) {
        HearthTreeNode newState=toRet.addChild(new HearthTreeNode((BoardState)toRet.data_.deepCopy()));
        newState.data_.getMinion_p1(index).setAttack((byte)1);
      }
    }
    return toRet;
  }
 else {
    return null;
  }
}
Program: 112809
Project: 112809
Buggy source:
@Override public void simulationFinished(){
  btnRun.setBackground(HSColors.SUCCESS_BUTTON_COLOR);
  btnRun.setText("String_Node_Str");
}

Fixed version (ground truth):
@Override public void simulationFinished(){
  btnRun.setBackground(HSColors.SUCCESS_BUTTON_COLOR);
  btnRun.setText("String_Node_Str");
  isRunning_=false;
}
Program: 112810
Project: 112810
Buggy source:
/** 
 * Create the application.
 */
public HearthSim(){
  hsModel_=new HSMainFrameModel(this);
  initialize();
  hsModel_.getSimulation().addSimulationEventListener(this);
}

Fixed version (ground truth):
/** 
 * Create the application.
 */
public HearthSim(){
  hsModel_=new HSMainFrameModel(this);
  isRunning_=false;
  initialize();
  hsModel_.getSimulation().addSimulationEventListener(this);
}
Program: 112812
Project: 112812
Buggy source:
@Override public void simulationStarted(){
  btnRun.setBackground(HSColors.ERROR_BUTTON_COLOR);
  btnRun.setText("String_Node_Str");
}

Fixed version (ground truth):
@Override public void simulationStarted(){
  btnRun.setBackground(HSColors.ERROR_BUTTON_COLOR);
  btnRun.setText("String_Node_Str");
  isRunning_=true;
}
Program: 112813
Project: 112813
Buggy source:
@Override public void run(){
  try {
    GameResult res=runSingleGame();
synchronized (writer_) {
      System.out.println("String_Node_Str" + gameId_ + "String_Node_Str"+ res.winnerPlayerIndex_+ "String_Node_Str");
      JSONObject json=new JSONObject();
      json.put("String_Node_Str",res.winnerPlayerIndex_);
      json.put("String_Node_Str",res.gameDuration_);
      json.put("String_Node_Str",res.record_.toJSON());
      writer_.write(json.toString() + "String_Node_Str");
      writer_.flush();
      results_[gameId_]=res;
    }
  }
 catch (  HSException|IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    GameResult res=runSingleGame();
synchronized (writer_) {
      System.out.println("String_Node_Str" + gameId_ + "String_Node_Str"+ res.winnerPlayerIndex_+ "String_Node_Str");
      JSONObject json=new JSONObject();
      json.put("String_Node_Str",res.winnerPlayerIndex_);
      json.put("String_Node_Str",res.gameDuration_);
      json.put("String_Node_Str",res.record_.toJSON());
      writer_.write(json.toString() + "String_Node_Str");
      writer_.flush();
      results_[gameId_]=res;
    }
  }
 catch (  HSException|IOException e) {
    System.out.println("String_Node_Str" + e);
    e.printStackTrace();
  }
}
Program: 112814
Project: 112814
Buggy source:
/** 
 * Play a turn This function is called by GameMaster, and it should return a BoardState resulting from the AI playing its turn.
 * @param turn Turn number, 1-based
 * @param board The board state at the beginning of the turn (after all card draws and minion deaths)
 * @param player The player playing the turn
 * @return
 * @throws HSException
 */
public BoardState playTurn(int turn,BoardState board,Player player0,Player player1) throws HSException {
  HearthTreeNode toRet=new HearthTreeNode(board);
  BoardStateFactory factory=new BoardStateFactory(player0.getDeck(),player1.getDeck());
  HearthTreeNode allMoves=factory.doMoves(toRet,this);
  HearthTreeNode bestPlay=allMoves.findMaxOfFunc(this);
  while (bestPlay instanceof StopNode) {
    HearthTreeNode allEffectsDone=((StopNode)bestPlay).finishAllEffects(player0.getDeck());
    HearthTreeNode allMovesAtferStopNode=factory.doMoves(allEffectsDone,this);
    bestPlay=allMovesAtferStopNode.findMaxOfFunc(this);
  }
  return bestPlay.data_;
}

Fixed version (ground truth):
/** 
 * Play a turn This function is called by GameMaster, and it should return a BoardState resulting from the AI playing its turn.
 * @param turn Turn number, 1-based
 * @param board The board state at the beginning of the turn (after all card draws and minion deaths)
 * @param player The player playing the turn
 * @return
 * @throws HSException
 */
public BoardState playTurn(int turn,BoardState board,Player player0,Player player1) throws HSException {
  HearthTreeNode toRet=new HearthTreeNode(board);
  BoardStateFactory factory=new BoardStateFactory(player0.getDeck(),player1.getDeck());
  HearthTreeNode allMoves=factory.doMoves(toRet,this);
  HearthTreeNode bestPlay=allMoves.findMaxOfFunc(this);
  while (bestPlay instanceof StopNode) {
    HearthTreeNode allEffectsDone=((StopNode)bestPlay).finishAllEffects(player0.getDeck());
    factory.resetTimeOut();
    HearthTreeNode allMovesAtferStopNode=factory.doMoves(allEffectsDone,this);
    bestPlay=allMovesAtferStopNode.findMaxOfFunc(this);
  }
  return bestPlay.data_;
}
Program: 112815
Project: 112815
Buggy source:
public void run(){
  Runnable r;
  while (true) {
synchronized (queue) {
      if (queue.isEmpty()) {
        break;
      }
      r=(Runnable)queue.removeFirst();
    }
    try {
      r.run();
    }
 catch (    RuntimeException e) {
    }
  }
}

Fixed version (ground truth):
public void run(){
  Runnable r;
  while (true) {
synchronized (queue) {
      if (queue.isEmpty()) {
        break;
      }
      r=(Runnable)queue.removeFirst();
    }
    try {
      r.run();
    }
 catch (    RuntimeException e) {
      e.printStackTrace();
    }
  }
}
Program: 112816
Project: 112816
Buggy source:
public double heroHealthScore_p1(double heroHealth,double heroArmor){
  double toRet=enemy_wHeroHealth_ * (heroHealth + heroArmor);
  if (heroHealth <= 0) {
    toRet+=100000.0;
  }
  return toRet;
}

Fixed version (ground truth):
public double heroHealthScore_p1(double heroHealth,double heroArmor){
  double toRet=-enemy_wHeroHealth_ * (heroHealth + heroArmor);
  if (heroHealth <= 0) {
    toRet+=100000.0;
  }
  return toRet;
}