nus-yam/ex-repair huggingface dataset:
Program: 19657
Project: 19657
Buggy source:
/** 
 * This method updates the panel for this group. The panel is the set of leaders in this group The size of the panel depends on the social position of the group. If it is at the very top it has a single leader (dictator). If it is at the bottom then every member belongs to the panel (anarchism).
 * @param none
 * @return The new panel members.
 */
private List<String> updatePanel(){
  double groupSocialPosition;
  int population, panelSize;
  population=getDataModel().getMemberList().size();
  groupSocialPosition=getDataModel().getEstimatedSocialLocation();
  panelSize=(int)Math.round(population * groupSocialPosition);
  if (panelSize == 0) {
    panelSize=1;
  }
  List<Tuple<String,Double>> panelCandidates=new LinkedList<Tuple<String,Double>>();
  List<String> groupMembers=getDataModel().getMemberList();
  for (  String candidate : groupMembers) {
    double sum=0;
    int numKnownTrustValues=0;
    for (    String member : groupMembers) {
      if ((getConn().getAgentById(member).getTrust(candidate) != null) && (!member.equals(candidate))) {
        sum+=getConn().getAgentById(member).getTrust(candidate);
        numKnownTrustValues++;
      }
    }
    Tuple<String,Double> tuple;
    if (numKnownTrustValues != 0) {
      tuple=new Tuple<String,Double>(candidate,sum / numKnownTrustValues);
      panelCandidates.add(tuple);
    }
  }
  Collections.sort(panelCandidates,d);
  List<String> newPanel=new LinkedList<String>();
  if (!panelCandidates.isEmpty() && (panelCandidates.size() >= panelSize)) {
    for (int i=0; i < panelSize; i++) {
      if (panelCandidates.get(i).getValue() >= groupSocialPosition) {
        newPanel.add(panelCandidates.get(i).getKey());
      }
    }
  }
  return newPanel;
}

Fixed version (ground truth):
/** 
 * This method updates the panel for this group. The panel is the set of leaders in this group The size of the panel depends on the social position of the group. If it is at the very top it has a single leader (dictator). If it is at the bottom then every member belongs to the panel (anarchism).
 * @param none
 * @return The new panel members.
 */
private List<String> updatePanel(){
  List<String> panel=new LinkedList<String>();
  return panel;
}
Program: 19658
Project: 19658
Buggy source:
@Override protected void agents(){
  Random randomGenerator=new Random();
  for (int i=0; i < 25; i++) {
    addAgent(new TestPoliticalAgent(20,2,AgentType.AC,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.TFT,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.AD,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.R,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
  }
}

Fixed version (ground truth):
@Override protected void agents(){
  Random randomGenerator=new Random();
  for (int i=0; i < 15; i++) {
    addAgent(new TestPoliticalAgent(20,2,AgentType.AC,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.TFT,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.AD,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.R,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
  }
}
Program: 19660
Project: 19660
Buggy source:
@Override protected void plugins(){
  addPlugin(new DebugSwitchPlugin());
  addPlugin(new HuntersAlivePlugin(getPath() + "String_Node_Str",1500,1200));
  addPlugin(new DatabasePlugin(comment,true));
  addPlugin(new HunterListPlugin());
  addPlugin(new PoliticalCompassPlugin());
  addPlugin(new PoliticalCompass2Plugin());
  addPlugin(new HunterInfo());
  addPlugin(new GroupInfo());
  addPlugin(new GroupGraphs());
}

Fixed version (ground truth):
@Override protected void plugins(){
  addPlugin(new DebugSwitchPlugin());
  addPlugin(new HuntersAlivePlugin(getPath() + "String_Node_Str",1500,1200));
  addPlugin(new HunterListPlugin());
  addPlugin(new PoliticalCompassPlugin());
  addPlugin(new PoliticalCompass2Plugin());
  addPlugin(new HunterInfo());
  addPlugin(new GroupInfo());
  addPlugin(new GroupGraphs());
}
Program: 19661
Project: 19661
Buggy source:
void getFreeAgentGroupData(int round,int pop){
  try {
    roundGroup.setInt(1,simId);
    roundGroup.setInt(2,round);
    roundGroup.setInt(3,0);
    roundGroup.setInt(4,pop);
    roundGroup.setDouble(5,-1);
    roundGroup.addBatch();
  }
 catch (  SQLException ex) {
    logger.log(Level.WARNING,null,ex);
  }
}

Fixed version (ground truth):
void getFreeAgentGroupData(int round,int pop){
  try {
    roundGroup.setInt(1,simId);
    roundGroup.setInt(2,round);
    roundGroup.setInt(3,0);
    roundGroup.setInt(4,pop);
    roundGroup.setDouble(5,-1);
    roundGroup.setDouble(6,-1);
    roundGroup.addBatch();
  }
 catch (  SQLException ex) {
    logger.log(Level.WARNING,null,ex);
  }
}
Program: 19662
Project: 19662
Buggy source:
void groupRound(int groupid,int round,PublicGroupDataModel group){
  try {
    roundGroup.setInt(1,simId);
    roundGroup.setInt(2,round);
    roundGroup.setInt(3,groupid);
    roundGroup.setInt(4,group.getMemberList().size());
    roundGroup.setDouble(5,group.getEstimatedSocialLocation());
    roundGroup.setDouble(6,-1);
    roundGroup.addBatch();
  }
 catch (  SQLException ex) {
    logger.log(Level.WARNING,"String_Node_Str" + "String_Node_Str",new Object[]{group.getName(),round,groupid,ex});
  }
}

Fixed version (ground truth):
void groupRound(int groupid,int round,PublicGroupDataModel group){
  try {
    roundGroup.setInt(1,simId);
    roundGroup.setInt(2,round);
    roundGroup.setInt(3,groupid);
    roundGroup.setInt(4,group.getMemberList().size());
    roundGroup.setDouble(5,group.getEstimatedSocialLocation());
    roundGroup.setDouble(6,group.getCurrentEconomicPoisition());
    roundGroup.addBatch();
  }
 catch (  SQLException ex) {
    logger.log(Level.WARNING,"String_Node_Str" + "String_Node_Str",new Object[]{group.getName(),round,groupid,ex});
  }
}
Program: 19663
Project: 19663
Buggy source:
/** 
 * Once the hunters have gathered their winnings, it is processed and distributed here
 */
private void doHandleHuntResults(){
}

Fixed version (ground truth):
/** 
 * Once the hunters have gathered their winnings, it is processed and distributed here
 */
private void doHandleHuntResults(){
  double shared=0;
  double taxRate=1 - dm.getCurrentEconomicPoisition();
  for (  Double value : huntResult.values()) {
    shared+=value;
  }
  for (  String specialAgent : getConn().getAgents()) {
    if (getConn().getAgentById(specialAgent).getName().equals(getId())) {
      PublicAgentDataModel groupSpecialAgent=getConn().getAgentById(specialAgent);
      double specialAgentFoodAmount=groupSpecialAgent.getFoodAmount();
      double extraFood=0;
      if (previousAmountHunted.get(getId()) != null) {
        extraFood=specialAgentFoodAmount - previousAmountHunted.get(getId());
      }
      previousAmountHunted.put(getId(),specialAgentFoodAmount);
      shared+=extraFood;
    }
  }
  Tuple<Double,Double> updatedSharedAndReserve=updateTaxedPool(shared);
  this.setReservedFood(updatedSharedAndReserve.getValue());
  shared=updatedSharedAndReserve.getKey();
  shared=shared * taxRate / dm.getMemberList().size();
  Map<String,Double> result=new HashMap<String,Double>(huntResult.size());
  for (  String agent : huntResult.keySet()) {
    double value=shared + (1 - taxRate) * huntResult.get(agent);
    result.put(agent,value);
  }
  List<String> informedAgents=new ArrayList<String>();
  for (  String agent : result.keySet()) {
    informedAgents.add(agent);
    ec.act(new DistributeFood(agent,huntResult.get(agent),result.get(agent)),getId(),authCode);
  }
  @SuppressWarnings("String_Node_Str") List<String> uninformedAgents=new ArrayList<String>(dm.getMemberList());
  uninformedAgents.removeAll(informedAgents);
  for (  String agent : uninformedAgents) {
    ec.act(new DistributeFood(agent,0,shared),getId(),authCode);
  }
}
Program: 19664
Project: 19664
Buggy source:
private void getGroupRoundData(){
  for (  Map.Entry<String,PublicGroupDataModel> entry : trackedGroups.entrySet()) {
    wrap.groupRound(idMap.get(entry.getKey()),round,entry.getValue());
  }
}

Fixed version (ground truth):
private void getGroupRoundData(){
  for (  Map.Entry<String,PublicGroupDataModel> entry : trackedGroups.entrySet()) {
    try {
      wrap.groupRound(idMap.get(entry.getKey()),round,entry.getValue());
    }
 catch (    NullPointerException ex) {
      logger.log(Level.WARNING,"String_Node_Str" + "String_Node_Str",new Object[]{entry.getValue().getName(),round});
    }
  }
}
Program: 19665
Project: 19665
Buggy source:
/** 
 * Sets up everything necessary to create the GUI, decode the XML and make Multi-Agent magic happen
 * @param args Command line arguments
 */
public static void main(String args[]) throws Exception {
  if (args.length == 0) {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    BuildSimulations.main(args);
    ControlCenter.main(args);
  }
 else {
    Logger.getLogger("String_Node_Str").setLevel(Level.WARNING);
    if (args.length == 1) {
      presage.Presage.main(args);
      return;
    }
    if (args.length == 2) {
      String name=args[0];
      Class<?> sim=Class.forName("String_Node_Str" + name);
      assert(GenericSimulation.class.isAssignableFrom(sim));
      long x=Long.parseLong(args[1]);
      GenericSimulation g=(GenericSimulation)sim.getConstructor(long.class).newInstance(x);
      name+=Long.toHexString(x);
      presage.Presage.main(new String[]{g.getPath() + File.separator + "String_Node_Str"});
      return;
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets up everything necessary to create the GUI, decode the XML and make Multi-Agent magic happen
 * @param args Command line arguments
 */
public static void main(String args[]) throws Exception {
  if (args.length == 0) {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    BuildSimulations.main(args);
    ControlCenter.main(args);
  }
 else {
    rootLogger.setLevel(Level.WARNING);
    PublicEnvironmentConnection.logger.setLevel(Level.WARNING);
    if (args.length == 1) {
      presage.Presage.main(args);
      return;
    }
    if (args.length == 2) {
      String name=args[0];
      Class<?> sim=Class.forName("String_Node_Str" + name);
      assert(GenericSimulation.class.isAssignableFrom(sim));
      long x=Long.parseLong(args[1]);
      GenericSimulation g=(GenericSimulation)sim.getConstructor(long.class).newInstance(x);
      name+=Long.toHexString(x);
      presage.Presage.main(new String[]{g.getPath() + File.separator + "String_Node_Str"});
      return;
    }
  }
}
Program: 19667
Project: 19667
Buggy source:
@Override protected void foods(){
  addFood("String_Node_Str",5,1);
  addFood("String_Node_Str",20,2);
}

Fixed version (ground truth):
@Override protected void foods(){
  addFood("String_Node_Str",2,1);
  addFood("String_Node_Str",10,2);
}
Program: 19668
Project: 19668
Buggy source:
public CLIPolitics(long rand){
  super("String_Node_Str",500,rand,0.1,Long.toHexString(rand));
}

Fixed version (ground truth):
public CLIPolitics(long rand){
  super("String_Node_Str",5000,rand,0.1,Long.toHexString(rand));
}
Program: 19669
Project: 19669
Buggy source:
@Override protected void agents(){
  Random randomGenerator=new Random(this.randomSeed);
  for (int i=0; i < 10; i++) {
    addAgent(new TestPoliticalAgent(20,2,AgentType.AC,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.TFT,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.AD,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.R,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
  }
}

Fixed version (ground truth):
@Override protected void agents(){
  Random randomGenerator=new Random(this.randomSeed);
  for (int i=0; i < 50; i++) {
    addAgent(new TestPoliticalAgent(20,2,AgentType.AC,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.TFT,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.AD,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.R,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
  }
}
Program: 19672
Project: 19672
Buggy source:
@Override protected void beforeNewRound(){
  if (!getConn().availableGroups().containsAll(inNeed.keySet())) {
    Set<String> available=getConn().availableGroups();
    for (    String inNeedMember : inNeed.keySet()) {
      if (!available.contains(inNeedMember)) {
        inNeed.remove(inNeedMember);
      }
    }
  }
  theMoneyIsOK(getDataModel().getCurrentReservedFood());
  if (getDataModel().getMemberList().size() != 1) {
    List<String> newPanel=updatePanel();
    this.setPanel(newPanel);
  }
}

Fixed version (ground truth):
@Override protected void beforeNewRound(){
  if (!getConn().availableGroups().containsAll(inNeed.keySet())) {
    Set<String> available=getConn().availableGroups();
    Iterator<String> i=inNeed.keySet().iterator();
    while (i.hasNext()) {
      String member=i.next();
      if (!available.contains(member)) {
        i.remove();
      }
    }
  }
  theMoneyIsOK(getDataModel().getCurrentReservedFood());
  if (getDataModel().getMemberList().size() != 1) {
    List<String> newPanel=updatePanel();
    this.setPanel(newPanel);
  }
}
Program: 19674
Project: 19674
Buggy source:
abstract protected void beforeNewRound();

Fixed version (ground truth):
/** 
 * Here you implement any code concerning data storage about the events of this round before it is all deleted for a new round to begin. N.B: a "round" occurs after all   {@link TurnType turn types} have beeniterated through. This is to avoid confusion between "cycles", "turn" and "time". Alternatively, use of the unit "Harcourt" may also be used. 1 Round = 1 Harcourt
 */
abstract protected void beforeNewRound();
Program: 19675
Project: 19675
Buggy source:
/** 
 * Here you implement any code concerning data storage about the events of this round before it is all deleted for a new round to begin. N.B: a "round" occurs after all   {@link TurnType turn types} have been iterated through. This is to avoid confusion between "cycles", "turn" and "time".  Alternatively, use of the unit "Harcourt" may also be used.  1 Round = 1 Harcourt
 */
abstract protected Tuple<AgentType,Double> makePayments();

Fixed version (ground truth):
abstract protected Tuple<AgentType,Double> makePayments();
Program: 19676
Project: 19676
Buggy source:
void flush(int round){
  try {
    newGroup.executeBatch();
    dieGroup.executeBatch();
    newAgent.executeBatch();
    dieAgent.executeBatch();
    roundGroup.executeBatch();
    roundAgent.executeBatch();
    if (!conn.getAutoCommit())     conn.commit();
  }
 catch (  SQLException ex) {
    logger.log(Level.WARNING,null,ex);
  }
}

Fixed version (ground truth):
void flush(int round){
  try {
    newGroup.executeBatch();
    dieGroup.executeBatch();
    newAgent.executeBatch();
    dieAgent.executeBatch();
    roundGroup.executeBatch();
    roundAgent.executeBatch();
    trustAgent.executeBatch();
    if (!conn.getAutoCommit())     conn.commit();
  }
 catch (  SQLException ex) {
    logger.log(Level.WARNING,null,ex);
  }
}
Program: 19677
Project: 19677
Buggy source:
void groupRound(int groupid,int round,PublicGroupDataModel group){
  try {
    roundGroup.setInt(1,simId);
    roundGroup.setInt(2,round);
    roundGroup.setInt(3,groupid);
    roundGroup.setInt(4,group.getMemberList().size());
    roundGroup.setDouble(5,group.getEstimatedSocialLocation());
    roundGroup.setDouble(6,group.getCurrentEconomicPoisition());
    roundGroup.addBatch();
  }
 catch (  SQLException ex) {
    logger.log(Level.WARNING,null,ex);
  }
}

Fixed version (ground truth):
void groupRound(int groupid,int round,PublicGroupDataModel group){
  try {
    roundGroup.setInt(1,simId);
    roundGroup.setInt(2,round);
    roundGroup.setInt(3,groupid);
    roundGroup.setInt(4,group.getMemberList().size());
    roundGroup.setDouble(5,group.getEstimatedSocialLocation());
    roundGroup.setDouble(6,group.getCurrentEconomicPoisition());
    roundGroup.addBatch();
  }
 catch (  SQLException ex) {
    logger.log(Level.WARNING,"String_Node_Str" + "String_Node_Str",new Object[]{group.getName(),round,groupid});
  }
}
Program: 19678
Project: 19678
Buggy source:
ConnectionWrapper(String url,String comment,String sim_uuid,Boolean remote) throws SQLException, ClassNotFoundException {
  if (!remote)   Class.forName("String_Node_Str");
  conn=DriverManager.getConnection(url);
  if (!remote) {
    updateDatabaseStructure();
    conn.setAutoCommit(false);
  }
  newAgent=conn.prepareStatement(Statements.addAgent.getPrototype());
  dieAgent=conn.prepareStatement(Statements.dieAgent.getPrototype());
  roundAgent=conn.prepareStatement(Statements.roundAgent.getPrototype());
  endAgent=conn.prepareStatement(Statements.endAgent.getPrototype());
  newGroup=conn.prepareStatement(Statements.addGroup.getPrototype());
  dieGroup=conn.prepareStatement(Statements.dieGroup.getPrototype());
  roundGroup=conn.prepareStatement(Statements.roundGroup.getPrototype());
  endGroup=conn.prepareStatement(Statements.endGroup.getPrototype());
  endSim=conn.prepareStatement(Statements.endSim.getPrototype());
  simId=initialiseSimulation(comment,sim_uuid,remote);
}

Fixed version (ground truth):
ConnectionWrapper(String url,String comment,String sim_uuid,Boolean remote) throws SQLException, ClassNotFoundException {
  if (!remote)   Class.forName("String_Node_Str");
  conn=DriverManager.getConnection(url);
  if (!remote) {
    updateDatabaseStructure();
    conn.setAutoCommit(false);
  }
  newAgent=conn.prepareStatement(Statements.addAgent.getPrototype());
  dieAgent=conn.prepareStatement(Statements.dieAgent.getPrototype());
  roundAgent=conn.prepareStatement(Statements.roundAgent.getPrototype());
  trustAgent=conn.prepareStatement(Statements.trustAgent.getPrototype());
  endAgent=conn.prepareStatement(Statements.endAgent.getPrototype());
  newGroup=conn.prepareStatement(Statements.addGroup.getPrototype());
  dieGroup=conn.prepareStatement(Statements.dieGroup.getPrototype());
  roundGroup=conn.prepareStatement(Statements.roundGroup.getPrototype());
  endGroup=conn.prepareStatement(Statements.endGroup.getPrototype());
  endSim=conn.prepareStatement(Statements.endSim.getPrototype());
  simId=initialiseSimulation(comment,sim_uuid,remote);
}
Program: 19680
Project: 19680
Buggy source:
@Override public void execute(){
  if (ec.getCurrentTurnType() != TurnType.firstTurn)   return;
  round=ec.getRoundsPassed();
  pruneOldGroups();
  findNewGroups();
  pruneOldAgents();
  findNewAgents();
  getGroupRoundData();
  wrap.getFreeAgentGroupData(round,ec.getUngroupedAgents().size());
  if (!remote)   getAgentRoundData();
  if (round % 50 == 0) {
    if (!remote)     logger.log(Level.INFO,"String_Node_Str");
 else     logger.log(Level.INFO,"String_Node_Str");
    wrap.flush(round);
    logger.log(Level.INFO,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void execute(){
  if (ec.getCurrentTurnType() != TurnType.firstTurn)   return;
  round=ec.getRoundsPassed();
  findNewGroups();
  findNewAgents();
  getGroupRoundData();
  wrap.getFreeAgentGroupData(round,ec.getUngroupedAgents().size());
  if (!remote)   getAgentRoundData();
  pruneOldAgents();
  pruneOldGroups();
  if (round % 50 == 0) {
    if (!remote)     logger.log(Level.INFO,"String_Node_Str");
 else     logger.log(Level.INFO,"String_Node_Str");
    wrap.flush(round);
    logger.log(Level.INFO,"String_Node_Str");
  }
}
Program: 19681
Project: 19681
Buggy source:
private void getAgentRoundData(){
  for (  Map.Entry<String,PublicAgentDataModel> entry : trackedAgents.entrySet()) {
    PublicAgentDataModel agent=entry.getValue();
    int groupid=idMap.get(agent.getGroupId());
    wrap.agentRound(idMap.get(entry.getKey()),groupid,round,agent);
  }
}

Fixed version (ground truth):
private void getAgentRoundData(){
  for (  Map.Entry<String,PublicAgentDataModel> entry : trackedAgents.entrySet()) {
    PublicAgentDataModel agent=entry.getValue();
    try {
      int groupid=idMap.get(agent.getGroupId());
      int agentid=idMap.get(entry.getKey());
      wrap.agentRound(agentid,groupid,round,agent);
      for (      Map.Entry<String,PublicAgentDataModel> entry2 : trackedAgents.entrySet()) {
        Double trust=agent.getTrust(entry2.getKey());
        if (trust != null) {
          int agentid_other=idMap.get(entry2.getKey());
          wrap.agentTrust(agentid,agentid_other,trust,round);
        }
      }
    }
 catch (    NullPointerException ex) {
      logger.log(Level.WARNING,"String_Node_Str" + "String_Node_Str",new Object[]{agent.getName(),round});
    }
  }
}
Program: 19682
Project: 19682
Buggy source:
@Override protected void plugins(){
  addPlugin(new DebugSwitchPlugin());
  addPlugin(new HuntersAlivePlugin(getPath() + "String_Node_Str",1500,1200));
  addPlugin(new HunterListPlugin());
  addPlugin(new PoliticalCompassPlugin());
  addPlugin(new PoliticalCompass2Plugin());
}

Fixed version (ground truth):
@Override protected void plugins(){
  addPlugin(new DebugSwitchPlugin());
  addPlugin(new HuntersAlivePlugin(getPath() + "String_Node_Str",1500,1200));
  addPlugin(new DatabasePlugin(comment,false));
  addPlugin(new HunterListPlugin());
  addPlugin(new PoliticalCompassPlugin());
  addPlugin(new PoliticalCompass2Plugin());
}
Program: 19684
Project: 19684
Buggy source:
@Override protected void plugins(){
  addPlugin(new DebugSwitchPlugin());
  addPlugin(new HuntersAlivePlugin(getPath() + "String_Node_Str",1500,1200));
  addPlugin(new HunterListPlugin());
  addPlugin(new PoliticalCompassPlugin());
  addPlugin(new PoliticalCompass2Plugin());
}

Fixed version (ground truth):
@Override protected void plugins(){
  addPlugin(new DebugSwitchPlugin());
  addPlugin(new HuntersAlivePlugin(getPath() + "String_Node_Str",1500,1200));
  addPlugin(new HunterListPlugin());
  addPlugin(new PoliticalCompassPlugin());
  addPlugin(new PoliticalCompass2Plugin());
  addPlugin(new HunterInfo());
  addPlugin(new GroupInfo());
  addPlugin(new GroupGraphs());
}
Program: 19685
Project: 19685
Buggy source:
public Politics(){
  super("String_Node_Str",400,0,0.1);
}

Fixed version (ground truth):
public Politics(){
  super("String_Node_Str",1000,0,0.1);
}
Program: 19686
Project: 19686
Buggy source:
@Override protected void agents(){
  Random randomGenerator=new Random();
  for (int i=0; i < 50; i++) {
    addAgent(new TestPoliticalAgent(20,2,AgentType.AC,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
  }
}

Fixed version (ground truth):
@Override protected void agents(){
  Random randomGenerator=new Random();
  for (int i=0; i < 20; i++) {
    addAgent(new TestPoliticalAgent(20,2,AgentType.AC,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.TFT,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.AD,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new TestPoliticalAgent(20,2,AgentType.R,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
  }
}
Program: 19687
Project: 19687
Buggy source:
@Override protected double decideTaxForReservePool(){
  double currentFoodReserve;
  if (getDataModel().getReservedFoodHistory().isEmpty()) {
    currentFoodReserve=0;
  }
 else {
    currentFoodReserve=getDataModel().getCurrentReservedFood();
  }
  double tax=0;
  double goalRatio=currentFoodReserve / achievementThreshold;
  if (inNeed.containsKey(this.getId())) {
    tax=1 - goalRatio;
  }
 else {
    if (taxLess) {
      tax=getAverageHappiness(0) * (1 - goalRatio) * 0.5;
    }
 else {
      tax=getAverageHappiness(0) * (1 - goalRatio);
    }
  }
  return tax;
}

Fixed version (ground truth):
@Override protected double decideTaxForReservePool(){
  double currentFoodReserve;
  if (getDataModel().getReservedFoodHistory().isEmpty()) {
    currentFoodReserve=0;
  }
 else {
    currentFoodReserve=getDataModel().getCurrentReservedFood();
  }
  double tax=0;
  double goalRatio=currentFoodReserve / achievementThreshold;
  if (inNeed.containsKey(this.getId())) {
    tax=1 - goalRatio;
  }
 else {
    tax=getAverageHappiness(0) * (1 - goalRatio);
  }
  return tax;
}
Program: 19688
Project: 19688
Buggy source:
@Override protected void beforeNewRound(){
  if (!getConn().availableGroups().containsAll(inNeed.keySet())) {
    Set<String> available=getConn().availableGroups();
    for (    String inNeedMember : inNeed.keySet()) {
      if (!available.contains(inNeedMember)) {
        inNeed.remove(inNeedMember);
      }
    }
  }
  taxLess=false;
  theMoneyIsOK(getDataModel().getCurrentReservedFood());
}

Fixed version (ground truth):
@Override protected void beforeNewRound(){
  if (!getConn().availableGroups().containsAll(inNeed.keySet())) {
    Set<String> available=getConn().availableGroups();
    for (    String inNeedMember : inNeed.keySet()) {
      if (!available.contains(inNeedMember)) {
        inNeed.remove(inNeedMember);
      }
    }
  }
  theMoneyIsOK(getDataModel().getCurrentReservedFood());
}
Program: 19689
Project: 19689
Buggy source:
private boolean theMoneyIsOK(double mostRecentReserve){
  double goalRatio=mostRecentReserve / achievementThreshold;
  double averageAmount=0;
  for (  String member : getDataModel().getMemberList()) {
    averageAmount+=getConn().getAgentById(member).getFoodAmount();
  }
  averageAmount=averageAmount / getDataModel().getMemberList().size();
  double goalMembersRatio=averageAmount / achievementThreshold;
  if (!inNeed.containsKey(this.getId())) {
    if (goalRatio < 0.15) {
      if (goalMembersRatio < 0.15) {
        inNeed.put(this.getId(),150.0);
        return false;
      }
      inNeed.put(this.getId(),150 - mostRecentReserve);
      return false;
    }
 else {
      if (goalMembersRatio < 0.15) {
        inNeed.put(this.getId(),150.0);
        taxLess=true;
        return false;
      }
 else {
        return true;
      }
    }
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
private boolean theMoneyIsOK(double mostRecentReserve){
  double deltaFoodReserve;
  if (getDataModel().getReservedFoodHistory().size() > 1) {
    deltaFoodReserve=mostRecentReserve - getDataModel().getReservedFoodHistory().getValue(1);
  }
 else {
    deltaFoodReserve=0;
  }
  double goalRatio=mostRecentReserve / achievementThreshold;
  if (!inNeed.containsKey(this.getId())) {
    if ((goalRatio < 0.15) && (deltaFoodReserve < 0)) {
      inNeed.put(this.getId(),150 - mostRecentReserve);
      return false;
    }
 else {
      return true;
    }
  }
 else {
    return false;
  }
}
Program: 19691
Project: 19691
Buggy source:
private void doInteractWithOtherGroups(){
  Tuple<InteractionResult,Double> interactionResult=interactWithOtherGroups();
switch (interactionResult.getKey()) {
case LoanTaken:
    this.setReservedFood(this.getDataModel().getCurrentReservedFood() + interactionResult.getValue());
case LoanGiven:
  this.setReservedFood(this.getDataModel().getCurrentReservedFood() - interactionResult.getValue());
case NothingHappened:
}
}

Fixed version (ground truth):
private void doInteractWithOtherGroups(){
  Tuple<InteractionResult,Double> interactionResult=interactWithOtherGroups();
switch (interactionResult.getKey()) {
case LoanTaken:
    this.setReservedFood(this.getDataModel().getCurrentReservedFood() + interactionResult.getValue());
  System.out.println("String_Node_Str" + getDataModel().getCurrentReservedFood());
break;
case LoanGiven:
this.setReservedFood(this.getDataModel().getCurrentReservedFood() - interactionResult.getValue());
System.out.println("String_Node_Str" + getDataModel().getCurrentReservedFood());
break;
case NothingHappened:
break;
}
}
Program: 19692
Project: 19692
Buggy source:
@Override protected void agents(){
  Random randomGenerator=new Random();
  for (int i=0; i < 150; i++) {
    addAgent(new LoansAgent(20,2,AgentType.AC,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
  }
}

Fixed version (ground truth):
@Override protected void agents(){
  Random randomGenerator=new Random();
  for (int i=0; i < 50; i++) {
    addAgent(new LoansAgent(20,2,AgentType.AC,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
  }
}
Program: 19694
Project: 19694
Buggy source:
@Override protected Tuple<AgentType,Double> makePayments(){
  double currentFoodReserve;
  AgentType strategy=getDataModel().getGroupStrategy();
  currentFoodReserve=getDataModel().getCurrentReservedFood();
  if (!inNeed.containsKey(this.getId())) {
    if (!loansTaken.isEmpty()) {
    }
    if (strategy != null) {
      currentFoodReserve-=priceToPlay;
      if (currentFoodReserve < priceToPlay) {
        currentFoodReserve+=priceToPlay;
        strategy=null;
      }
    }
    if (this.greediness > new Random().nextDouble()) {
      double goalRatio=currentFoodReserve / achievementThreshold;
      double percentDecrease;
      percentDecrease=((1 - getAverageHappiness(0)) * goalRatio) * currentFoodReserve;
      if (currentFoodReserve - percentDecrease > priceToPlay) {
        currentFoodReserve-=percentDecrease;
      }
    }
  }
 else {
    strategy=null;
  }
  return new Tuple<AgentType,Double>(strategy,currentFoodReserve);
}

Fixed version (ground truth):
@Override protected Tuple<AgentType,Double> makePayments(){
  double currentFoodReserve;
  AgentType strategy=getDataModel().getGroupStrategy();
  currentFoodReserve=getDataModel().getCurrentReservedFood();
  if (!inNeed.containsKey(this.getId())) {
    if (!loansTaken.isEmpty()) {
      for (      String s : loansTaken.keySet()) {
        System.out.println("String_Node_Str" + loansTaken.get(s).getKey() + "String_Node_Str"+ getConn().getGroupById(s).getName()+ "String_Node_Str"+ loansTaken.get(s).getValue());
      }
    }
    if (strategy != null) {
      currentFoodReserve-=priceToPlay;
      if (currentFoodReserve < priceToPlay) {
        currentFoodReserve+=priceToPlay;
        strategy=null;
      }
    }
    if (this.greediness > new Random().nextDouble()) {
      double goalRatio=currentFoodReserve / achievementThreshold;
      double percentDecrease;
      percentDecrease=((1 - getAverageHappiness(0)) * goalRatio) * currentFoodReserve;
      if (currentFoodReserve - percentDecrease > priceToPlay) {
        currentFoodReserve-=percentDecrease;
      }
    }
  }
 else {
    strategy=null;
  }
  return new Tuple<AgentType,Double>(strategy,currentFoodReserve);
}
Program: 19695
Project: 19695
Buggy source:
private void doInteractWithOtherGroups(){
  Tuple<InteractionResult,Double> interactionResult=interactWithOtherGroups();
switch (interactionResult.getKey()) {
case LoanTaken:
    this.setReservedFood(this.getDataModel().getCurrentReservedFood() + interactionResult.getValue());
  System.out.println("String_Node_Str" + getDataModel().getCurrentReservedFood());
break;
case LoanGiven:
this.setReservedFood(this.getDataModel().getCurrentReservedFood() - interactionResult.getValue());
System.out.println("String_Node_Str" + getDataModel().getCurrentReservedFood());
break;
case NothingHappened:
break;
}
}

Fixed version (ground truth):
private void doInteractWithOtherGroups(){
  Tuple<InteractionResult,Double> interactionResult=interactWithOtherGroups();
switch (interactionResult.getKey()) {
case LoanTaken:
    this.setReservedFood(this.getDataModel().getCurrentReservedFood() + interactionResult.getValue());
  break;
case LoanGiven:
this.setReservedFood(this.getDataModel().getCurrentReservedFood() - interactionResult.getValue());
break;
case NothingHappened:
break;
}
}
Program: 19696
Project: 19696
Buggy source:
@Override protected double decideTaxForReservePool(){
  double currentFoodReserve;
  if (getDataModel().getReservedFood().isEmpty())   currentFoodReserve=0;
 else   currentFoodReserve=getDataModel().getCurrentReservedFood();
  double tax=0;
  double deltaHappiness=getAverageHappiness(0) - getAverageHappiness(1);
  double goalRatio=currentFoodReserve / achievementThreshold;
  if (theMoneyIsOK(currentFoodReserve)) {
    if (deltaHappiness < 0) {
      tax=Math.abs(deltaHappiness) * (1 - goalRatio);
    }
 else {
      tax=1 - goalRatio;
    }
  }
 else {
    tax=1 - goalRatio;
  }
  return tax;
}

Fixed version (ground truth):
@Override protected double decideTaxForReservePool(){
  double currentFoodReserve;
  if (getDataModel().getReservedFoodHistory().isEmpty())   currentFoodReserve=0;
 else   currentFoodReserve=getDataModel().getCurrentReservedFood();
  double tax=0;
  double deltaHappiness=getAverageHappiness(0) - getAverageHappiness(1);
  double goalRatio=currentFoodReserve / achievementThreshold;
  if (theMoneyIsOK(currentFoodReserve)) {
    if (deltaHappiness < 0) {
      tax=Math.abs(deltaHappiness) * (1 - goalRatio);
    }
 else {
      tax=1 - goalRatio;
    }
  }
 else {
    tax=1 - goalRatio;
  }
  return tax;
}
Program: 19698
Project: 19698
Buggy source:
private boolean theMoneyIsOK(double mostRecentReserve){
  double currentFoodReserve=getDataModel().getCurrentReservedFood();
  if (currentFoodReserve > 100) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
private boolean theMoneyIsOK(double mostRecentReserve){
  double oneTurnAgoFoodReserve;
  if (getDataModel().getReservedFoodHistory().size() > 1) {
    oneTurnAgoFoodReserve=getDataModel().getReservedFoodHistory().getValue(1);
  }
 else {
    oneTurnAgoFoodReserve=0;
  }
  if (mostRecentReserve > 100) {
    return true;
  }
 else   if ((mostRecentReserve <= 100) && (mostRecentReserve < oneTurnAgoFoodReserve)) {
    inNeed.put(this.getId(),mostRecentReserve);
    return false;
  }
 else   return false;
}
Program: 19699
Project: 19699
Buggy source:
private void doInteractWithOtherGroups(){
  Tuple<InteractionResult,Double> interactionResult=interactWithOtherGroups();
switch (interactionResult.getKey()) {
case LoanTaken:
    this.setReservedFood(this.getDataModel().getCurrentReservedFood() + interactionResult.getValue());
case LoanGiven:
  this.setReservedFood(this.getDataModel().getCurrentReservedFood() - interactionResult.getValue());
case NothingHappened:
this.setReservedFood(this.getDataModel().getCurrentReservedFood() + interactionResult.getValue());
}
}

Fixed version (ground truth):
private void doInteractWithOtherGroups(){
  Tuple<InteractionResult,Double> interactionResult=interactWithOtherGroups();
switch (interactionResult.getKey()) {
case LoanTaken:
    this.setReservedFood(this.getDataModel().getCurrentReservedFood() + interactionResult.getValue());
case LoanGiven:
  this.setReservedFood(this.getDataModel().getCurrentReservedFood() - interactionResult.getValue());
case NothingHappened:
this.setReservedFood(this.getDataModel().getCurrentReservedFood());
}
}
Program: 19700
Project: 19700
Buggy source:
void clearRoundData(){
  economicPosition.newEntry(true);
  propositionHistory.newEntry(null);
}

Fixed version (ground truth):
void clearRoundData(){
  economicPosition.newEntry(true);
  reservedFoodHistory.newEntry(true);
  propositionHistory.newEntry(null);
}
Program: 19701
Project: 19701
Buggy source:
private double getAverageHappiness(int turnsAgo){
  double average=0;
  if (!getDataModel().getMemberList().isEmpty()) {
    Double happiness;
    for (    String member : getDataModel().getMemberList()) {
      if (turnsAgo > 0) {
        happiness=getConn().getAgentById(member).getCurrentHappiness();
        if (happiness != null) {
          average+=happiness;
        }
      }
 else {
        happiness=getConn().getAgentById(member).getHappinessHistory().getValue(turnsAgo);
        if (happiness != null) {
          average+=happiness;
        }
      }
    }
    average=average / getDataModel().getMemberList().size();
  }
  return average;
}

Fixed version (ground truth):
private double getAverageHappiness(int turnsAgo){
  double average=0;
  if (!getDataModel().getMemberList().isEmpty()) {
    Double happiness;
    for (    String member : getDataModel().getMemberList()) {
      if (turnsAgo > 0) {
        if (getConn().getAgentById(member).getHappinessHistory().size() > 1) {
          happiness=getConn().getAgentById(member).getHappinessHistory().getValue(turnsAgo);
        }
 else {
          happiness=0.0;
        }
        if (happiness != null) {
          average+=happiness;
        }
      }
 else {
        happiness=getConn().getAgentById(member).getCurrentHappiness();
        if (happiness != null) {
          average+=happiness;
        }
      }
    }
    average=average / getDataModel().getMemberList().size();
  }
  return average;
}
Program: 19703
Project: 19703
Buggy source:
private boolean theMoneyIsOK(double mostRecentReserve){
  if (inNeed.containsKey(this.getId()))   return false;
  double oneTurnAgoFoodReserve=getDataModel().getReservedFoodHistory().getValue(1);
  if (mostRecentReserve > 100) {
    return true;
  }
 else   if ((mostRecentReserve <= 100) && (oneTurnAgoFoodReserve - mostRecentReserve > 20)) {
    inNeed.put(this.getId(),100 - mostRecentReserve);
    System.out.println(getDataModel().getName() + "String_Node_Str" + (100 - mostRecentReserve)+ "String_Node_Str");
    return false;
  }
 else   return false;
}

Fixed version (ground truth):
private boolean theMoneyIsOK(double mostRecentReserve){
  if (inNeed.containsKey(this.getId()))   return false;
  double oneTurnAgoFoodReserve=getDataModel().getReservedFoodHistory().getValue(1);
  if (mostRecentReserve >= 100) {
    return true;
  }
 else   if ((mostRecentReserve < 100) && (oneTurnAgoFoodReserve - mostRecentReserve > 20)) {
    inNeed.put(this.getId(),100 - mostRecentReserve);
    return false;
  }
 else   return false;
}
Program: 19704
Project: 19704
Buggy source:
@Override protected void agents(){
  Random randomGenerator=new Random();
  for (int i=0; i < 20; i++) {
    addAgent(new LoansAgent(20,2,AgentType.AC,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
  }
}

Fixed version (ground truth):
@Override protected void agents(){
  Random randomGenerator=new Random();
  for (int i=0; i < 50; i++) {
    addAgent(new LoansAgent(20,2,AgentType.AC,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
  }
}
Program: 19705
Project: 19705
Buggy source:
@Override protected double updateLoyaltyAfterVotes(Proposition proposition,int votes,double overallMovement){
  return 0;
}

Fixed version (ground truth):
@Override protected double updateLoyaltyAfterVotes(Proposition proposition,int votes,double overallMovement){
  return this.getDataModel().getCurrentLoyalty();
}
Program: 19707
Project: 19707
Buggy source:
@Override protected double updateHappinessAfterVotes(Proposition proposition,int votes,double overallMovement){
  return 0;
}

Fixed version (ground truth):
@Override protected double updateHappinessAfterVotes(Proposition proposition,int votes,double overallMovement){
  return this.getDataModel().getCurrentHappiness();
}
Program: 19708
Project: 19708
Buggy source:
private void isTheMoneyOK(double mostRecentReserve){
  double deltaFoodReserve;
  if (getDataModel().getReservedFoodHistory().getValue() == null) {
    deltaFoodReserve=mostRecentReserve;
  }
 else {
    deltaFoodReserve=mostRecentReserve - getDataModel().getReservedFoodHistory().getValue();
  }
  if (deltaFoodReserve > 0) {
    reserveTrend++;
  }
 else   if (deltaFoodReserve < 0) {
    reserveTrend--;
  }
  if ((reserveTrend < -3) && (mostRecentReserve < 150) && (!inNeed.containsKey(this.getId()))) {
    inNeed.put(this.getId(),mostRecentReserve);
  }
}

Fixed version (ground truth):
private void isTheMoneyOK(double mostRecentReserve){
  double deltaFoodReserve;
  if (getDataModel().getReservedFoodHistory().getValue() == null) {
    deltaFoodReserve=mostRecentReserve;
  }
 else {
    deltaFoodReserve=mostRecentReserve - getDataModel().getReservedFoodHistory().getValue();
  }
  if ((deltaFoodReserve < 0) && (mostRecentReserve < 150) && (!inNeed.containsKey(this.getId()))) {
    inNeed.put(this.getId(),mostRecentReserve);
  }
}
Program: 19710
Project: 19710
Buggy source:
@Override protected Tuple<AgentType,Double> makePayments(){
  double currentFoodReserve;
  if (getDataModel().getReservedFoodHistory().isEmpty()) {
    currentFoodReserve=0;
  }
 else {
    currentFoodReserve=getDataModel().getCurrentReservedFood();
  }
  AgentType strategy=getDataModel().getGroupStrategy();
  if (!loansTaken.isEmpty()) {
  }
  if (strategy != null) {
    currentFoodReserve-=priceToPlay;
    if (currentFoodReserve < priceToPlay) {
      currentFoodReserve+=priceToPlay;
      strategy=null;
    }
  }
  double deltaHappiness=getAverageHappiness(0) - getAverageHappiness(1);
  if (deltaHappiness < 0) {
    double goalRatio=currentFoodReserve / achievementThreshold;
    double percentDecrease=(Math.abs(deltaHappiness) * goalRatio) * currentFoodReserve;
    currentFoodReserve-=percentDecrease;
    if (currentFoodReserve < priceToPlay) {
      currentFoodReserve+=percentDecrease;
    }
  }
  isTheMoneyOK(currentFoodReserve);
  return new Tuple<AgentType,Double>(strategy,currentFoodReserve);
}

Fixed version (ground truth):
@Override protected Tuple<AgentType,Double> makePayments(){
  double currentFoodReserve;
  if (getDataModel().getReservedFoodHistory().isEmpty()) {
    currentFoodReserve=0;
  }
 else {
    currentFoodReserve=getDataModel().getCurrentReservedFood();
  }
  AgentType strategy=getDataModel().getGroupStrategy();
  if (!loansTaken.isEmpty()) {
  }
  if (strategy != null) {
    currentFoodReserve-=priceToPlay;
    if (currentFoodReserve < priceToPlay) {
      currentFoodReserve+=priceToPlay;
      strategy=null;
    }
  }
  double deltaHappiness=getAverageHappiness(0) - getAverageHappiness(1);
  double goalRatio=currentFoodReserve / achievementThreshold;
  double percentDecrease;
  if (deltaHappiness < 0) {
    percentDecrease=(deltaHappiness * goalRatio) * currentFoodReserve;
    currentFoodReserve+=percentDecrease;
    if (currentFoodReserve < priceToPlay) {
      currentFoodReserve-=percentDecrease;
    }
  }
 else {
    percentDecrease=(getAverageHappiness(0) * goalRatio) * currentFoodReserve;
    currentFoodReserve-=percentDecrease;
    if (currentFoodReserve < priceToPlay) {
      currentFoodReserve+=percentDecrease;
    }
  }
  isTheMoneyOK(currentFoodReserve);
  return new Tuple<AgentType,Double>(strategy,currentFoodReserve);
}
Program: 19712
Project: 19712
Buggy source:
@Override protected void beforeNewRound(){
  theMoneyIsOK(getDataModel().getCurrentReservedFood());
}

Fixed version (ground truth):
@Override protected void beforeNewRound(){
  if (!getConn().availableGroups().containsAll(inNeed.keySet())) {
    Set<String> available=getConn().availableGroups();
    for (    String inNeedMember : inNeed.keySet()) {
      if (!available.contains(inNeedMember)) {
        inNeed.remove(inNeedMember);
      }
    }
  }
  theMoneyIsOK(getDataModel().getCurrentReservedFood());
}
Program: 19713
Project: 19713
Buggy source:
private void isTheMoneyOK(double mostRecentReserve){
  double deltaFoodReserve;
  if (getDataModel().getReservedFoodHistory().getValue() == null) {
    deltaFoodReserve=mostRecentReserve;
  }
 else {
    deltaFoodReserve=mostRecentReserve - getDataModel().getReservedFoodHistory().getValue();
  }
  if ((deltaFoodReserve < 0) && (mostRecentReserve < 150) && (!inNeed.containsKey(this.getId()))) {
    inNeed.put(this.getId(),mostRecentReserve);
  }
}

Fixed version (ground truth):
private void isTheMoneyOK(double mostRecentReserve){
  double deltaFoodReserve;
  if (getDataModel().getReservedFoodHistory().getValue() == null) {
    deltaFoodReserve=mostRecentReserve;
  }
 else {
    deltaFoodReserve=mostRecentReserve - getDataModel().getReservedFoodHistory().getValue(1);
  }
  if ((deltaFoodReserve < 0) && (mostRecentReserve < 150) && (!inNeed.containsKey(this.getId()))) {
    inNeed.put(this.getId(),mostRecentReserve);
  }
}
Program: 19714
Project: 19714
Buggy source:
@Override protected double decideTaxForReservePool(){
  double currentFoodReserve;
  if (getDataModel().getReservedFoodHistory().isEmpty())   currentFoodReserve=0;
 else   currentFoodReserve=getDataModel().getCurrentReservedFood();
  double tax=0;
  double deltaHappiness=getAverageHappiness(0) - getAverageHappiness(1);
  double goalRatio=currentFoodReserve / achievementThreshold;
  if (reserveTrend < -3 && currentFoodReserve < 150) {
    tax=1 - goalRatio;
  }
 else {
    if (deltaHappiness < 0) {
      tax=Math.abs(deltaHappiness) * (1 - goalRatio);
    }
 else {
      tax=1 - goalRatio;
    }
  }
  return tax;
}

Fixed version (ground truth):
@Override protected double decideTaxForReservePool(){
  double currentFoodReserve;
  if (getDataModel().getReservedFoodHistory().isEmpty()) {
    currentFoodReserve=0;
  }
 else {
    currentFoodReserve=getDataModel().getCurrentReservedFood();
  }
  isTheMoneyOK(currentFoodReserve);
  double tax=0;
  double goalRatio=currentFoodReserve / achievementThreshold;
  if (currentFoodReserve < 150) {
    tax=1 - goalRatio;
  }
 else {
    tax=Math.abs(getAverageHappiness(0)) * (1 - goalRatio);
  }
  return tax;
}
Program: 19716
Project: 19716
Buggy source:
@Override protected Tuple<AgentType,Double> makePayments(){
  double currentFoodReserve;
  if (getDataModel().getReservedFoodHistory().isEmpty()) {
    currentFoodReserve=0;
  }
 else {
    currentFoodReserve=getDataModel().getCurrentReservedFood();
  }
  AgentType strategy=getDataModel().getGroupStrategy();
  if (!loansTaken.isEmpty()) {
  }
  if (strategy != null) {
    currentFoodReserve-=priceToPlay;
    if (currentFoodReserve < priceToPlay) {
      currentFoodReserve+=priceToPlay;
      strategy=null;
    }
  }
  double deltaHappiness=getAverageHappiness(0) - getAverageHappiness(1);
  double goalRatio=currentFoodReserve / achievementThreshold;
  double percentDecrease;
  if (deltaHappiness < 0) {
    percentDecrease=(deltaHappiness * goalRatio) * currentFoodReserve;
    currentFoodReserve+=percentDecrease;
    if (currentFoodReserve < priceToPlay) {
      currentFoodReserve-=percentDecrease;
    }
  }
 else {
    percentDecrease=(getAverageHappiness(0) * goalRatio) * currentFoodReserve;
    currentFoodReserve-=percentDecrease;
    if (currentFoodReserve < priceToPlay) {
      currentFoodReserve+=percentDecrease;
    }
  }
  isTheMoneyOK(currentFoodReserve);
  return new Tuple<AgentType,Double>(strategy,currentFoodReserve);
}

Fixed version (ground truth):
@Override protected Tuple<AgentType,Double> makePayments(){
  double currentFoodReserve;
  if (getDataModel().getReservedFoodHistory().isEmpty()) {
    currentFoodReserve=0;
  }
 else {
    currentFoodReserve=getDataModel().getCurrentReservedFood();
  }
  AgentType strategy=getDataModel().getGroupStrategy();
  if (!loansTaken.isEmpty()) {
  }
  if (strategy != null) {
    currentFoodReserve-=priceToPlay;
    if (currentFoodReserve < priceToPlay) {
      currentFoodReserve+=priceToPlay;
      strategy=null;
    }
  }
  double goalRatio=currentFoodReserve / achievementThreshold;
  double percentDecrease;
  percentDecrease=((1 - getAverageHappiness(0)) * goalRatio) * currentFoodReserve;
  if (currentFoodReserve - percentDecrease > priceToPlay) {
    currentFoodReserve-=percentDecrease;
  }
  return new Tuple<AgentType,Double>(strategy,currentFoodReserve);
}
Program: 19717
Project: 19717
Buggy source:
void clearRoundData(){
  economicPosition.newEntry(true);
  reservedFoodHistory.newEntry(true);
  propositionHistory.newEntry(null);
}

Fixed version (ground truth):
void clearRoundData(){
  economicPosition.newEntry(true);
  propositionHistory.newEntry(null);
  reservedFoodHistory.newEntry(true);
}
Program: 19718
Project: 19718
Buggy source:
@Override protected void agents(){
  Random randomGenerator=new Random();
  for (int i=0; i < 50; i++) {
    addAgent(new LoansAgent(20,2,AgentType.AC,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
  }
}

Fixed version (ground truth):
@Override protected void agents(){
  Random randomGenerator=new Random();
  for (int i=0; i < 50; i++) {
    addAgent(new LoansAgent(20,2,AgentType.AC,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
    addAgent(new LoansAgent(20,2,AgentType.AD,randomGenerator.nextDouble(),randomGenerator.nextDouble()));
  }
}