nus-yam/ex-repair huggingface dataset:
Program: 19765
Project: 19765
Buggy source:
@Override protected double updateLoyaltyAfterHunt(double foodHunted,double foodReceived){
  if (this.getDataModel().getGroupId() != null) {
    double myEconomic=getDataModel().getEconomicBelief();
    double myGroupEconomic=getConn().getGroupById(getDataModel().getGroupId()).getCurrentEconomicPoisition();
    double deltaEconomic=Math.abs(myGroupEconomic - myEconomic);
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str" + getDataModel().getEconomicBelief());
    System.out.println("String_Node_Str" + foodHunted + "String_Node_Str");
    System.out.println("String_Node_Str" + entitlement);
    System.out.println("String_Node_Str" + foodReceived);
    if (surplus == 0)     System.out.println("String_Node_Str");
 else     if (surplus > 0)     System.out.println("String_Node_Str");
 else     System.out.println("String_Node_Str");
    Double currentHappiness=getDataModel().getCurrentHappiness();
    if (currentHappiness == null) {
      currentHappiness=0.5 * myEconomic;
    }
    double newHappiness=updateHappinessAfterHunt(foodHunted,foodReceived);
    double deltaHappiness=newHappiness - currentHappiness;
    Double currentLoyalty=getDataModel().getCurrentLoyalty();
    if (currentLoyalty == null || currentLoyalty == 0)     currentLoyalty=0.5 * (currentHappiness + deltaEconomic);
    double newLoyalty=currentLoyalty;
    if (deltaHappiness > 0) {
      newLoyalty+=ValueScaler.scale(deltaHappiness,deltaEconomic,0.01);
      if (newLoyalty >= 1)       return 1;
 else       return newLoyalty;
    }
    if (deltaHappiness < 0) {
      newLoyalty-=ValueScaler.scale(Math.abs(deltaHappiness),deltaEconomic,0.01);
      if (newLoyalty <= 0)       return 0.001;
 else       return newLoyalty;
    }
    newLoyalty+=ValueScaler.scale(0,deltaEconomic,0.01);
    if (newLoyalty >= 1)     return 1;
 else     return newLoyalty;
  }
 else   return 0;
}

Fixed version (ground truth):
@Override protected double updateLoyaltyAfterHunt(double foodHunted,double foodReceived){
  if (this.getDataModel().getGroupId() != null) {
    double myEconomic=getDataModel().getEconomicBelief();
    double myGroupEconomic=getConn().getGroupById(getDataModel().getGroupId()).getCurrentEconomicPoisition();
    double deltaEconomic=Math.abs(myGroupEconomic - myEconomic);
    Double currentHappiness=getDataModel().getCurrentHappiness();
    if (currentHappiness == null) {
      currentHappiness=0.5 * myEconomic;
    }
    Double oneTurnAgoHappiness=this.getDataModel().getHappinessHistory().getValue(1);
    double deltaHappiness=currentHappiness - oneTurnAgoHappiness;
    Double currentLoyalty=getDataModel().getCurrentLoyalty();
    if (currentLoyalty == null || currentLoyalty == 0)     currentLoyalty=0.5 * (currentHappiness + deltaEconomic);
    if (deltaHappiness > 0) {
      currentLoyalty=ValueScaler.scale(currentLoyalty,deltaHappiness,deltaEconomic);
    }
 else     if (deltaHappiness < 0) {
      currentLoyalty=ValueScaler.scale(currentLoyalty,deltaHappiness,deltaEconomic);
    }
 else     currentLoyalty=ValueScaler.scale(currentLoyalty,0,deltaEconomic);
    return currentLoyalty;
  }
 else   return 0;
}
Program: 19766
Project: 19766
Buggy source:
public Politics(){
  super("String_Node_Str",3000,0,0.1);
}

Fixed version (ground truth):
public Politics(){
  super("String_Node_Str",300,0,0.1);
}
Program: 19767
Project: 19767
Buggy source:
@Override protected double updateHappinessAfterHunt(double foodHunted,double foodReceived){
  double entitlement=getDataModel().getEconomicBelief() * foodHunted;
  double surplus=foodReceived - entitlement;
  Double currentHappiness=getDataModel().getCurrentHappiness();
  if (currentHappiness == null)   currentHappiness=0.5 * getDataModel().getEconomicBelief();
  double newHappiness=currentHappiness;
  if (surplus > 0) {
    newHappiness+=ValueScaler.scale(surplus,entitlement,0.01);
    if (newHappiness >= 1)     return 1;
 else     return newHappiness;
  }
  if (surplus < 0) {
    newHappiness-=ValueScaler.scale(Math.abs(surplus),entitlement,0.01);
    if (newHappiness <= 0)     return 0;
 else     return newHappiness;
  }
  newHappiness+=ValueScaler.scale(0,entitlement,0.01);
  if (newHappiness >= 1)   return 1;
 else   return newHappiness;
}

Fixed version (ground truth):
@Override protected double updateHappinessAfterHunt(double foodHunted,double foodReceived){
  double entitlement=getDataModel().getEconomicBelief() * foodHunted;
  double surplus=foodReceived - entitlement;
  Double currentHappiness=getDataModel().getCurrentHappiness();
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str" + getDataModel().getEconomicBelief());
  System.out.println("String_Node_Str" + foodHunted + "String_Node_Str");
  System.out.println("String_Node_Str" + entitlement);
  System.out.println("String_Node_Str" + foodReceived);
  if (surplus == 0)   System.out.println("String_Node_Str");
 else   if (surplus > 0)   System.out.println("String_Node_Str");
 else   System.out.println("String_Node_Str");
  if (currentHappiness == null)   currentHappiness=0.5 * getDataModel().getEconomicBelief();
  System.out.println("String_Node_Str" + currentHappiness);
  if (surplus > 0) {
    currentHappiness=ValueScaler.scale(currentHappiness,surplus,0.1);
  }
 else   if (surplus < 0) {
    currentHappiness=ValueScaler.scale(currentHappiness,surplus,0.1);
  }
 else {
    currentHappiness=ValueScaler.scale(currentHappiness,surplus,0.1);
  }
  System.out.println("String_Node_Str" + currentHappiness);
  return currentHappiness;
}
Program: 19768
Project: 19768
Buggy source:
private String agentGroupGrouping(){
  String chosenGroup="String_Node_Str";
  double currentHeuristic=0, previousHeuristic=0;
  double vectorDistance;
  double maxDistance=Math.sqrt(2);
  double economic, social, esFaction=0;
  double trustFaction=0, trustSum;
  int numKnownTrustValues;
  PublicGroupDataModel aGroup;
  for (  String groupID : getConn().availableGroups()) {
    aGroup=getConn().getGroupById(groupID);
    numKnownTrustValues=0;
    trustSum=0;
    for (    String trustee : aGroup.getMemberList()) {
      Double trustValue=this.getDataModel().getTrust(trustee);
      if (trustValue != null) {
        trustSum+=trustValue;
        numKnownTrustValues++;
      }
    }
    if (numKnownTrustValues != 0)     trustFaction=trustSum / numKnownTrustValues;
 else     trustFaction=0;
    economic=aGroup.getCurrentEconomicPoisition() - this.getDataModel().getEconomicBelief();
    social=aGroup.getEstimatedSocialLocation() - getDataModel().getSocialBelief();
    vectorDistance=Math.sqrt(Math.pow(economic,2) + Math.pow(social,2));
    esFaction=1 - (vectorDistance / maxDistance);
    currentHeuristic=0.5 * trustFaction + 0.5 * esFaction;
    if ((currentHeuristic > 0.5) && (previousHeuristic < currentHeuristic)) {
      chosenGroup=aGroup.getId();
      previousHeuristic=currentHeuristic;
    }
  }
  return chosenGroup;
}

Fixed version (ground truth):
private String agentGroupGrouping(){
  String chosenGroup="String_Node_Str";
  double currentHeuristic=0, previousHeuristic=0;
  double vectorDistance;
  double maxDistance=Math.sqrt(2);
  double economic, social, esFaction=0;
  double trustFaction=0, trustSum;
  int numKnownTrustValues;
  PublicGroupDataModel aGroup;
  for (  String groupID : getConn().availableGroups()) {
    aGroup=getConn().getGroupById(groupID);
    numKnownTrustValues=0;
    trustSum=0;
    for (    String trustee : aGroup.getMemberList()) {
      Double trustValue=this.getDataModel().getTrust(trustee);
      if (trustValue != null) {
        trustSum+=trustValue;
        numKnownTrustValues++;
      }
    }
    if (numKnownTrustValues != 0)     trustFaction=trustSum / numKnownTrustValues;
 else     trustFaction=0;
    economic=aGroup.getCurrentEconomicPoisition() - this.getDataModel().getEconomicBelief();
    social=aGroup.getEstimatedSocialLocation() - getDataModel().getSocialBelief();
    vectorDistance=Math.sqrt(Math.pow(economic,2) + Math.pow(social,2));
    esFaction=1 - (vectorDistance / maxDistance);
    currentHeuristic=0.5 * trustFaction + 0.5 * esFaction;
    if ((currentHeuristic > 0.4) && (previousHeuristic < currentHeuristic)) {
      chosenGroup=aGroup.getId();
      previousHeuristic=currentHeuristic;
    }
  }
  return chosenGroup;
}
Program: 19769
Project: 19769
Buggy source:
@Override protected ProposalType makeProposal(){
  String groupId=this.getDataModel().getGroupId();
  ProposalType proposal;
  double groupEconomicPosition=this.getConn().getGroupById(groupId).getCurrentEconomicPoisition();
  double agentEconomicBelief=this.getDataModel().getEconomicBelief();
  System.out.println("String_Node_Str" + agentEconomicBelief);
  System.out.println("String_Node_Str" + groupEconomicPosition);
  if (agentEconomicBelief > groupEconomicPosition) {
    proposal=ProposalType.moveRight;
  }
 else   if (agentEconomicBelief < groupEconomicPosition) {
    proposal=ProposalType.moveLeft;
  }
 else {
    proposal=ProposalType.staySame;
  }
  return proposal;
}

Fixed version (ground truth):
@Override protected ProposalType makeProposal(){
  String groupId=this.getDataModel().getGroupId();
  ProposalType proposal;
  double groupEconomicPosition=this.getConn().getGroupById(groupId).getCurrentEconomicPoisition();
  double agentEconomicBelief=this.getDataModel().getEconomicBelief();
  if (agentEconomicBelief > groupEconomicPosition) {
    proposal=ProposalType.moveRight;
  }
 else   if (agentEconomicBelief < groupEconomicPosition) {
    proposal=ProposalType.moveLeft;
  }
 else {
    proposal=ProposalType.staySame;
  }
  return proposal;
}
Program: 19771
Project: 19771
Buggy source:
@Override protected VoteType castVote(Proposition p){
  return VoteType.For;
}

Fixed version (ground truth):
@Override protected VoteType castVote(Proposition p){
  String groupId=this.getDataModel().getGroupId();
  String proposerGroup=p.getOwnerGroup();
  ProposalType agentProposal;
  VoteType vote;
  if (groupId != null) {
    if (groupId.equals(proposerGroup)) {
      double groupEconomicPosition=this.getConn().getGroupById(groupId).getCurrentEconomicPoisition();
      double agentEconomicBelief=this.getDataModel().getEconomicBelief();
      if (agentEconomicBelief > groupEconomicPosition) {
        agentProposal=ProposalType.moveRight;
      }
 else       if (agentEconomicBelief < groupEconomicPosition) {
        agentProposal=ProposalType.moveLeft;
      }
 else {
        agentProposal=ProposalType.staySame;
      }
      System.out.println("String_Node_Str" + p.getType());
      if (p.getType().equals(agentProposal)) {
        vote=VoteType.For;
      }
 else {
        vote=VoteType.Against;
      }
    }
 else {
      throw new UnsupportedOperationException("String_Node_Str");
    }
  }
 else {
    vote=VoteType.Abstain;
  }
  System.out.println("String_Node_Str" + vote);
  System.out.println("String_Node_Str");
  return vote;
}
Program: 19773
Project: 19773
Buggy source:
public Politics(){
  super("String_Node_Str",200,0,0.1);
}

Fixed version (ground truth):
public Politics(){
  super("String_Node_Str",400,0,0.1);
}
Program: 19774
Project: 19774
Buggy source:
@Override protected void agents(){
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.5,0.5));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.5,0.4));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.5,0.3));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,1.0,1.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,1.0,0.9));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.9,1.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.2,0.2));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.1,0.3));
  Random randomGenerator=new Random();
  for (int i=0; i < 5; 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 < 5; 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: 19776
Project: 19776
Buggy source:
@Override protected String chooseGroup(){
  System.out.println("String_Node_Str");
  if (this.getDataModel().getGroupId() == null)   System.out.println("String_Node_Str" + this.getDataModel().getName() + "String_Node_Str");
 else   System.out.println("String_Node_Str" + this.getDataModel().getName() + "String_Node_Str"+ this.getDataModel().getEconomicBelief()+ "String_Node_Str"+ getConn().getGroupById(this.getDataModel().getGroupId()).getName());
  System.out.println("String_Node_Str" + getConn().availableGroups().size());
  String chosenGroup="String_Node_Str";
  if (this.getDataModel().getGroupId() != null) {
    return this.getDataModel().getGroupId();
  }
 else   if (this.invitationToGroup != null) {
    System.out.println("String_Node_Str");
    invitationHolders.remove(this.getId());
    String invitation=this.invitationToGroup;
    this.invitationToGroup=null;
    return invitation;
  }
 else {
    chosenGroup=agentGroupGrouping();
    if (chosenGroup.equals("String_Node_Str"))     System.out.println("String_Node_Str" + this.getConn().getAgentById(this.getId()).getName() + "String_Node_Str");
 else     System.out.println("String_Node_Str" + this.getConn().getAgentById(this.getId()).getName() + "String_Node_Str");
  }
  if (chosenGroup.equals("String_Node_Str")) {
    chosenGroup=freeAgentsGrouping();
    if ((chosenGroup == null))     System.out.println("String_Node_Str" + this.getConn().getAgentById(this.getId()).getName() + "String_Node_Str");
 else     System.out.println("String_Node_Str" + this.getConn().getAgentById(this.getId()).getName() + "String_Node_Str");
  }
  return chosenGroup;
}

Fixed version (ground truth):
@Override protected String chooseGroup(){
  System.out.println("String_Node_Str");
  if (this.getDataModel().getGroupId() == null)   System.out.println("String_Node_Str" + this.getDataModel().getName() + "String_Node_Str");
 else   System.out.println("String_Node_Str" + this.getDataModel().getName() + "String_Node_Str"+ this.getDataModel().getEconomicBelief()+ "String_Node_Str"+ getConn().getGroupById(this.getDataModel().getGroupId()).getName());
  System.out.println("String_Node_Str" + getConn().availableGroups().size());
  String chosenGroup="String_Node_Str";
  if (this.getDataModel().getGroupId() != null) {
    return null;
  }
 else   if (this.invitationToGroup != null) {
    System.out.println("String_Node_Str");
    return this.invitationToGroup;
  }
 else {
    chosenGroup=agentGroupGrouping();
    if (chosenGroup.equals("String_Node_Str"))     System.out.println("String_Node_Str" + this.getConn().getAgentById(this.getId()).getName() + "String_Node_Str");
 else     System.out.println("String_Node_Str" + this.getConn().getAgentById(this.getId()).getName() + "String_Node_Str");
  }
  if (chosenGroup.equals("String_Node_Str")) {
    chosenGroup=freeAgentsGrouping();
    if ((chosenGroup == null))     System.out.println("String_Node_Str" + this.getConn().getAgentById(this.getId()).getName() + "String_Node_Str");
 else     System.out.println("String_Node_Str" + this.getConn().getAgentById(this.getId()).getName() + "String_Node_Str");
  }
  return chosenGroup;
}
Program: 19777
Project: 19777
Buggy source:
@Override protected boolean respondToJoinRequest(String playerID){
  if (getDataModel().getMemberList().isEmpty())   return true;
  if (getDataModel().getMemberList().size() == 1)   return true;
  double heuristic=0;
  double vectorDistance;
  double maxDistance=Math.sqrt(2);
  double economic, social, esFaction=0;
  double trustFaction=0, trustSum=0;
  int numKnownTrustValues=0;
  for (  String trustor : this.getDataModel().getMemberList()) {
    Double trustValue=this.getConn().getAgentById(trustor).getTrust(playerID);
    if (trustValue != null) {
      trustSum+=trustValue;
      numKnownTrustValues++;
    }
  }
  if (numKnownTrustValues != 0) {
    trustFaction=trustSum / numKnownTrustValues;
  }
  economic=this.getConn().getAgentById(playerID).getEconomicBelief() - this.getDataModel().getCurrentEconomicPoisition();
  social=this.getConn().getAgentById(playerID).getSocialBelief() - this.getDataModel().getEstimatedSocialLocation();
  vectorDistance=Math.sqrt(Math.pow(economic,2) + Math.pow(social,2));
  esFaction=1 - (vectorDistance / maxDistance);
  heuristic=0.5 * trustFaction + 0.5 * esFaction;
  if (heuristic > 0.5) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override protected boolean respondToJoinRequest(String playerID){
  return true;
}
Program: 19778
Project: 19778
Buggy source:
@Override protected void plugins(){
  addPlugin(new DebugSwitchPlugin());
  addPlugin(new HuntersAlivePlugin(getPath() + "String_Node_Str",1500,1200));
  addPlugin(new ErrorLog());
  addPlugin(new DatabasePlugin(1,"String_Node_Str",false));
  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 ErrorLog());
  addPlugin(new DatabasePlugin(1,"String_Node_Str",false));
  addPlugin(new HunterListPlugin());
  addPlugin(new PoliticalCompassPlugin());
  addPlugin(new TrustLogPlugin());
  addPlugin(new PoliticalCompass2Plugin());
}
Program: 19779
Project: 19779
Buggy source:
public Politics(){
  super("String_Node_Str",150,0,0.1);
}

Fixed version (ground truth):
public Politics(){
  super("String_Node_Str",300,0,0.1);
}
Program: 19780
Project: 19780
Buggy source:
@Override protected void agents(){
  Random randomGenerator=new Random();
  for (int i=0; i < 5; 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(){
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,1.0,1.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,1.0,1.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
}
Program: 19781
Project: 19781
Buggy source:
/** 
 * Draws a circle representing an agent's political views
 * @param g Graphics objects
 * @param p_player SimplifiedPoliticalPlayer object to draw
 */
private void drawAgent(Graphics g,TestPoliticalAgent p_player){
  Rectangle rect=g.getClipBounds();
  g.setColor(Color.BLUE);
  g.fillOval((int)((p_player.getDataModel().getEconomicBelief()) * rect.width),(int)((p_player.getDataModel().getSocialBelief()) * rect.height),10,10);
}

Fixed version (ground truth):
private void drawAgent(Graphics g,TestPoliticalAgent p_player){
  Rectangle rect=g.getClipBounds();
  g.setColor(Color.BLUE);
  g.fillOval((int)((p_player.getDataModel().getEconomicBelief()) * rect.width),(int)((p_player.getDataModel().getSocialBelief()) * rect.height),10,10);
}
Program: 19782
Project: 19782
Buggy source:
/** 
 * Draw everything to the screen
 * @param g Graphics object
 */
@Override public void paint(Graphics g){
  g.setColor(Color.LIGHT_GRAY);
  g.fillRect(0,0,getWidth(),getHeight());
  Rectangle rect=g.getClipBounds();
  g.setColor(Color.DARK_GRAY);
  g.drawLine(rect.width / 2,0,rect.width / 2,rect.height);
  g.drawLine(0,rect.height / 2,rect.width,rect.height / 2);
  for (  Map.Entry<String,TestPoliticalAgent> entry : p_players.entrySet()) {
    drawAgent(g,entry.getValue());
  }
}

Fixed version (ground truth):
/** 
 * Draw everything to the screen
 * @param g Graphics object
 */
@Override public void paint(Graphics g){
  g.setColor(Color.LIGHT_GRAY);
  g.fillRect(0,0,getWidth(),getHeight());
  Rectangle rect=g.getClipBounds();
  g.setColor(Color.DARK_GRAY);
  g.drawLine(rect.width / 2,0,rect.width / 2,rect.height);
  g.drawLine(0,rect.height / 2,rect.width,rect.height / 2);
  for (  Map.Entry<String,TestPoliticalAgent> entry : p_players.entrySet()) {
    drawAgent(g,entry.getValue());
  }
  drawGroupLines(g);
}
Program: 19783
Project: 19783
Buggy source:
/** 
 * Initialises a plugin that was stored using the SimpleXML framework, making it ready to be used in the visualisation of a simulation
 * @param sim The simulation to which this plugin will belong
 */
@Override public void initialise(Simulation sim){
  System.out.println("String_Node_Str");
  this.sim=sim;
  setBackground(Color.CYAN);
  repaint();
}

Fixed version (ground truth):
/** 
 * Initialises a plugin that was stored using the SimpleXML framework, making it ready to be used in the visualisation of a simulation
 * @param sim The simulation to which this plugin will belong
 */
@Override public void initialise(Simulation sim){
  System.out.println("String_Node_Str");
  this.sim=sim;
  this.en=(Environment)sim.environment;
  setBackground(Color.CYAN);
  repaint();
}
Program: 19784
Project: 19784
Buggy source:
public Politics(){
  super("String_Node_Str",300,0,0.1);
}

Fixed version (ground truth):
public Politics(){
  super("String_Node_Str",350,0,0.1);
}
Program: 19785
Project: 19785
Buggy source:
@Override protected void agents(){
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,1.0,1.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,1.0,1.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
}

Fixed version (ground truth):
@Override protected void agents(){
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.5));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,1.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.5,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,1.0,1.0));
  Random randomGenerator=new Random();
  for (int i=0; i < 5; 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: 19786
Project: 19786
Buggy source:
@Override protected boolean respondToJoinRequest(String playerID){
  return true;
}

Fixed version (ground truth):
@Override protected boolean respondToJoinRequest(String playerID){
  if (getDataModel().getMemberList().isEmpty())   return true;
  if (getDataModel().getMemberList().size() == 1)   return true;
  double heuristic=0;
  double vectorDistance;
  double maxDistance=Math.sqrt(2);
  double economic, social, esFaction=0;
  double trustFaction=0, trustSum=0;
  int numKnownTrustValues=0;
  for (  String trustor : this.getDataModel().getMemberList()) {
    Double trustValue=this.getConn().getAgentById(trustor).getTrust(playerID);
    if (trustValue != null) {
      trustSum+=trustValue;
      numKnownTrustValues++;
    }
  }
  if (numKnownTrustValues != 0) {
    trustFaction=trustSum / numKnownTrustValues;
  }
  economic=this.getConn().getAgentById(playerID).getEconomicBelief() - this.getDataModel().getCurrentEconomicPoisition();
  social=this.getConn().getAgentById(playerID).getSocialBelief() - this.getDataModel().getEstimatedSocialLocation();
  vectorDistance=Math.sqrt(Math.pow(economic,2) + Math.pow(social,2));
  esFaction=1 - (vectorDistance / maxDistance);
  heuristic=0.5 * trustFaction + 0.5 * esFaction;
  if (heuristic > 0.5) {
    return true;
  }
 else {
    return false;
  }
}
Program: 19787
Project: 19787
Buggy source:
@Override protected void agents(){
  Random randomGenerator=new Random();
  for (int i=0; i < 1; 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(){
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,1.0,1.0));
}
Program: 19788
Project: 19788
Buggy source:
@Override protected Map<String,Double> updateTrustAfterHunt(double foodHunted,double foodReceived){
  List<String> members=this.getDataModel().getHuntingTeam().getMembers();
  if (members.size() < 2)   return null;
  String opponentID;
  Map<String,Double> newTrustValue=new HashMap<String,Double>();
  double trust;
  if (members.get(0).equals(this.getId())) {
    opponentID=members.get(1);
  }
 else {
    opponentID=members.get(1);
  }
  if (this.getDataModel().getTrust(opponentID) != null)   trust=this.getDataModel().getTrust(opponentID);
 else   trust=0;
  if (this.getDataModel().getLastHunted().getName().equals("String_Node_Str")) {
    if (foodHunted == 0) {
      trust=ValueScaler.scale(trust,-1,0.1);
    }
 else {
      trust=ValueScaler.scale(trust,1,0.1);
    }
  }
 else {
    trust=ValueScaler.scale(trust,1,0);
  }
  System.out.println(trust);
  newTrustValue.put(opponentID,trust);
  return newTrustValue;
}

Fixed version (ground truth):
@Override protected Map<String,Double> updateTrustAfterHunt(double foodHunted,double foodReceived){
  List<String> members=this.getDataModel().getHuntingTeam().getMembers();
  if (members.size() < 2)   return null;
  String opponentID;
  Map<String,Double> newTrustValue=new HashMap<String,Double>();
  double trust;
  if (members.get(0).equals(this.getId())) {
    opponentID=members.get(1);
  }
 else {
    opponentID=members.get(0);
  }
  if (this.getDataModel().getTrust(opponentID) != null)   trust=this.getDataModel().getTrust(opponentID);
 else   trust=0;
  if (this.getDataModel().getLastHunted().getName().equals("String_Node_Str")) {
    if (foodHunted == 0) {
      trust=ValueScaler.scale(trust,-1,0.1);
    }
 else {
      trust=ValueScaler.scale(trust,1,0.1);
    }
  }
 else {
    trust=ValueScaler.scale(trust,0,0.1);
  }
  System.out.println(trust);
  newTrustValue.put(opponentID,trust);
  return newTrustValue;
}
Program: 19789
Project: 19789
Buggy source:
@Override protected void agents(){
  for (int i=0; i < 10; i++) {
    addAgent(new TestPoliticalAgent(20,2,AgentType.AC));
    addAgent(new TestPoliticalAgent(20,2,AgentType.TFT));
  }
}

Fixed version (ground truth):
@Override protected void agents(){
  for (int i=0; i < 10; i++) {
    addAgent(new TestPoliticalAgent(20,2,AgentType.AC));
    addAgent(new TestPoliticalAgent(20,2,AgentType.TFT));
    addAgent(new TestPoliticalAgent(20,2,AgentType.AD));
    addAgent(new TestPoliticalAgent(20,2,AgentType.R));
  }
}
Program: 19791
Project: 19791
Buggy source:
@Override protected boolean respondToJoinRequest(String playerID){
  double heuristic;
  double vectorDistance;
  double maxDistance=Math.sqrt(2);
  double economic, social, esFaction;
  double trustFaction, trustSum=0;
  int numKnownTrustValues=0;
  for (  String trustor : this.getDataModel().getMemberList()) {
    Double trustValue=this.getConn().getAgentById(trustor).getTrust(playerID);
    if (trustValue != null) {
      trustSum+=trustValue;
      numKnownTrustValues++;
    }
  }
  if (numKnownTrustValues == 0) {
    return true;
  }
  trustFaction=trustSum / numKnownTrustValues;
  economic=this.getConn().getAgentById(playerID).getEconomicBelief() - this.getDataModel().getCurrentEconomicPoisition();
  social=this.getConn().getAgentById(playerID).getSocialBelief() - this.getDataModel().getEstimatedSocialLocation();
  vectorDistance=Math.sqrt(Math.pow(economic,2) + Math.pow(social,2));
  esFaction=1 - (vectorDistance / maxDistance);
  heuristic=0.5 * trustFaction + 0.5 * esFaction;
  if (heuristic > 0.5) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override protected boolean respondToJoinRequest(String playerID){
  return true;
}
Program: 19792
Project: 19792
Buggy source:
@Override protected void groupApplicationResponse(boolean accepted){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override protected void groupApplicationResponse(boolean accepted){
}
Program: 19793
Project: 19793
Buggy source:
@Override protected String chooseGroup(){
  System.out.println(this.getDataModel().getEconomicBelief());
  System.out.println(this.getDataModel().getSocialBelief());
  System.out.println();
  return null;
}

Fixed version (ground truth):
@Override protected String chooseGroup(){
  if (this.getDataModel().getGroupId() != null)   return this.getDataModel().getGroupId();
  String chosenGroup="String_Node_Str";
  double currentHeuristic, previousHeuristic=0;
  double vectorDistance;
  double maxDistance=Math.sqrt(2);
  double economic, social, esFaction;
  double trustFaction, trustSum;
  int numKnownTrustValues;
  System.out.println(getConn().availableGroups().size());
  if (chosenGroup.equals("String_Node_Str")) {
    String optimalGrouping="String_Node_Str";
    for (    String trustee : getConn().getUngroupedAgents()) {
      Double trustValue=this.getDataModel().getTrust(trustee);
      if (trustValue != null) {
        trustFaction=trustValue;
        economic=getConn().getAgentById(trustee).getEconomicBelief() - getDataModel().getEconomicBelief();
        social=getConn().getAgentById(trustee).getSocialBelief() - getDataModel().getSocialBelief();
        vectorDistance=Math.sqrt(Math.pow(economic,2) + Math.pow(social,2));
        esFaction=1 - (vectorDistance / maxDistance);
        currentHeuristic=0.5 * trustFaction + 0.5 * esFaction;
        if (currentHeuristic > 0.5 && (previousHeuristic < currentHeuristic)) {
          optimalGrouping=trustee;
          previousHeuristic=currentHeuristic;
        }
      }
    }
    if (optimalGrouping.equals("String_Node_Str")) {
      return null;
    }
 else {
      GroupDataInitialiser myGroup=new GroupDataInitialiser(this.uniformRandLong(),(this.getDataModel().getEconomicBelief() + getConn().getAgentById(optimalGrouping).getEconomicBelief()) / 2);
      Class<? extends AbstractGroupAgent> gtype=getConn().getAllowedGroupTypes().get(0);
      chosenGroup=getConn().createGroup(gtype,myGroup);
    }
  }
  return chosenGroup;
}
Program: 19794
Project: 19794
Buggy source:
public Politics(){
  super("String_Node_Str",100,0,0.1);
}

Fixed version (ground truth):
public Politics(){
  super("String_Node_Str",300,0,0.1);
}
Program: 19795
Project: 19795
Buggy source:
@Override protected Map<String,Double> updateTrustAfterHunt(double foodHunted,double foodReceived){
  List<String> members=this.getDataModel().getHuntingTeam().getMembers();
  if (members.size() < 2)   return null;
  String opponentID;
  Map<String,Double> newTrustValue=new HashMap<String,Double>();
  double trust;
  if (members.get(0).equals(this.getId())) {
    opponentID=members.get(1);
  }
 else {
    opponentID=members.get(0);
  }
  if (this.getDataModel().getTrust(opponentID) != null)   trust=this.getDataModel().getTrust(opponentID);
 else   trust=0;
  if (this.getDataModel().getLastHunted().getName().equals("String_Node_Str")) {
    if (foodHunted == 0) {
      trust=ValueScaler.scale(trust,-1,0.1);
    }
 else {
      trust=ValueScaler.scale(trust,1,0.1);
    }
  }
 else {
    trust=ValueScaler.scale(trust,0,0.1);
  }
  newTrustValue.put(opponentID,trust);
  return newTrustValue;
}

Fixed version (ground truth):
@Override protected Map<String,Double> updateTrustAfterHunt(double foodHunted,double foodReceived){
  Food lastHunted=this.getDataModel().getLastHunted();
  List<String> members=this.getDataModel().getHuntingTeam().getMembers();
  if ((lastHunted == null) || (members.size() < 2))   return null;
  String opponentID;
  Map<String,Double> newTrustValue=new HashMap<String,Double>();
  double trust;
  if (members.get(0).equals(this.getId())) {
    opponentID=members.get(1);
  }
 else {
    opponentID=members.get(0);
  }
  if (this.getDataModel().getTrust(opponentID) != null)   trust=this.getDataModel().getTrust(opponentID);
 else   trust=0;
  if (lastHunted.getName().equals("String_Node_Str")) {
    if (foodHunted == 0) {
      trust=ValueScaler.scale(trust,-1,0.1);
    }
 else {
      trust=ValueScaler.scale(trust,1,0.1);
    }
  }
 else {
    trust=ValueScaler.scale(trust,0,0.1);
  }
  newTrustValue.put(opponentID,trust);
  return newTrustValue;
}
Program: 19796
Project: 19796
Buggy source:
public Politics(){
  super("String_Node_Str",5000,0,0.1);
}

Fixed version (ground truth):
public Politics(){
  super("String_Node_Str",300,0,0.1);
}
Program: 19797
Project: 19797
Buggy source:
@Override protected void agents(){
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,0.0,0.0));
  addAgent(new TestPoliticalAgent(20,2,AgentType.AC,1.0,1.0));
}

Fixed version (ground truth):
@Override protected void agents(){
  Random randomGenerator=new Random();
  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()));
  }
}
Program: 19798
Project: 19798
Buggy source:
@Override protected Map<String,Double> updateTrustAfterHunt(double foodHunted,double foodReceived){
  List<String> members=this.getDataModel().getHuntingTeam().getMembers();
  if (members.size() < 2)   return null;
  String opponentID;
  Map<String,Double> newTrustValue=new HashMap<String,Double>();
  double trust;
  if (members.get(0).equals(this.getId())) {
    opponentID=members.get(1);
  }
 else {
    opponentID=members.get(0);
  }
  if (this.getDataModel().getTrust(opponentID) != null)   trust=this.getDataModel().getTrust(opponentID);
 else   trust=0;
  if (this.getDataModel().getLastHunted().getName().equals("String_Node_Str")) {
    if (foodHunted == 0) {
      trust=ValueScaler.scale(trust,-1,0.1);
    }
 else {
      trust=ValueScaler.scale(trust,1,0.1);
    }
  }
 else {
    trust=ValueScaler.scale(trust,0,0.1);
  }
  System.out.println(trust);
  newTrustValue.put(opponentID,trust);
  return newTrustValue;
}

Fixed version (ground truth):
@Override protected Map<String,Double> updateTrustAfterHunt(double foodHunted,double foodReceived){
  List<String> members=this.getDataModel().getHuntingTeam().getMembers();
  if (members.size() < 2)   return null;
  String opponentID;
  Map<String,Double> newTrustValue=new HashMap<String,Double>();
  double trust;
  if (members.get(0).equals(this.getId())) {
    opponentID=members.get(1);
  }
 else {
    opponentID=members.get(0);
  }
  if (this.getDataModel().getTrust(opponentID) != null)   trust=this.getDataModel().getTrust(opponentID);
 else   trust=0;
  if (this.getDataModel().getLastHunted().getName().equals("String_Node_Str")) {
    if (foodHunted == 0) {
      trust=ValueScaler.scale(trust,-1,0.1);
    }
 else {
      trust=ValueScaler.scale(trust,1,0.1);
    }
  }
 else {
    trust=ValueScaler.scale(trust,0,0.1);
  }
  newTrustValue.put(opponentID,trust);
  return newTrustValue;
}
Program: 19799
Project: 19799
Buggy source:
@Override protected String chooseGroup(){
  if (this.getDataModel().getGroupId() != null)   return null;
  if (getConn().availableGroups().isEmpty())   return null;
  String chosenGroup="String_Node_Str";
  PublicGroupDataModel aGroup;
  double currentHeuristic, previousHeuristic=0;
  double vectorDistance;
  double maxDistance=Math.sqrt(2);
  double economic, social, esFaction;
  double trustFaction, trustSum;
  int numKnownTrustValues;
  for (  String groupID : getConn().availableGroups()) {
    aGroup=getConn().getGroupById(groupID);
    numKnownTrustValues=0;
    trustSum=0;
    for (    String trustee : aGroup.getMemberList()) {
      Double trustValue=this.getDataModel().getTrust(trustee);
      if (trustValue != null) {
        trustSum+=trustValue;
        numKnownTrustValues++;
      }
    }
    trustFaction=trustSum / numKnownTrustValues;
    economic=aGroup.getCurrentEconomicPoisition() - this.getDataModel().getEconomicBelief();
    social=aGroup.getEstimatedSocialLocation() - this.socialBelief;
    vectorDistance=Math.sqrt(Math.pow(economic,2) + Math.pow(social,2));
    esFaction=1 - (vectorDistance / maxDistance);
    currentHeuristic=0.5 * trustFaction + 0.5 * esFaction;
    if (currentHeuristic > 0.5 && previousHeuristic < currentHeuristic) {
      chosenGroup=aGroup.getId();
      previousHeuristic=currentHeuristic;
    }
  }
  if (chosenGroup.equals("String_Node_Str")) {
    GroupDataInitialiser myGroup=new GroupDataInitialiser(0,this.getDataModel().getEconomicBelief());
    chosenGroup=getConn().createGroup(TestPoliticalGroup.class,myGroup);
  }
  return chosenGroup;
}

Fixed version (ground truth):
@Override protected String chooseGroup(){
  String chosenGroup="String_Node_Str";
  PublicGroupDataModel aGroup;
  double currentHeuristic, previousHeuristic=0;
  double vectorDistance;
  double maxDistance=Math.sqrt(2);
  double economic, social, esFaction;
  double trustFaction, trustSum;
  int numKnownTrustValues;
  for (  String groupID : getConn().availableGroups()) {
    aGroup=getConn().getGroupById(groupID);
    numKnownTrustValues=0;
    trustSum=0;
    for (    String trustee : aGroup.getMemberList()) {
      Double trustValue=this.getDataModel().getTrust(trustee);
      if (trustValue != null) {
        trustSum+=trustValue;
        numKnownTrustValues++;
      }
    }
    trustFaction=trustSum / numKnownTrustValues;
    economic=aGroup.getCurrentEconomicPoisition() - this.getDataModel().getEconomicBelief();
    social=aGroup.getEstimatedSocialLocation() - this.socialBelief;
    vectorDistance=Math.sqrt(Math.pow(economic,2) + Math.pow(social,2));
    esFaction=1 - (vectorDistance / maxDistance);
    currentHeuristic=0.5 * trustFaction + 0.5 * esFaction;
    if (currentHeuristic > 0.5 && previousHeuristic < currentHeuristic) {
      chosenGroup=aGroup.getId();
      previousHeuristic=currentHeuristic;
    }
  }
  return chosenGroup;
}
Program: 19800
Project: 19800
Buggy source:
@Override protected void groups(){
}

Fixed version (ground truth):
@Override protected void groups(){
  addGroup(TestPoliticalGroup.class);
}
Program: 19801
Project: 19801
Buggy source:
public Politics(){
  super("String_Node_Str",1000,0,0.1);
}

Fixed version (ground truth):
public Politics(){
  super("String_Node_Str",200,0,0.1);
}
Program: 19802
Project: 19802
Buggy source:
@Override protected Food chooseFood(){
  Food[] foodArray=new Food[2];
  Food cooperateFood, defectFood, choice;
  int i=0;
  for (  Food noms : getConn().availableFoods()) {
    foodArray[i]=noms;
    i++;
  }
  if (foodArray[0].getNutrition() > foodArray[1].getNutrition()) {
    cooperateFood=foodArray[0];
    defectFood=foodArray[1];
  }
 else {
    cooperateFood=foodArray[1];
    defectFood=foodArray[0];
  }
switch (type) {
case AC:
    choice=cooperateFood;
  break;
case AD:
choice=defectFood;
break;
case R:
Random random=new Random();
if (random.nextInt(2) == 0) choice=cooperateFood;
 else choice=defectFood;
break;
case TFT:
List<String> members=this.getDataModel().getHuntingTeam().getMembers();
Food opponentPreviousChoice=cooperateFood;
if (members.get(0).equals(this.getId())) {
if (getConn().getAgentById(members.get(1)).getHuntingHistory().size() != 1) {
opponentPreviousChoice=getConn().getAgentById(members.get(1)).getHuntingHistory().getValue(1);
}
}
 else {
if (getConn().getAgentById(members.get(0)).getHuntingHistory().size() != 1) {
opponentPreviousChoice=getConn().getAgentById(members.get(0)).getHuntingHistory().getValue(1);
}
}
choice=opponentPreviousChoice;
break;
default :
throw new IllegalStateException("String_Node_Str");
}
return choice;
}

Fixed version (ground truth):
@Override protected Food chooseFood(){
  Food[] foodArray=new Food[2];
  Food cooperateFood, defectFood, choice;
  int i=0;
  for (  Food noms : getConn().availableFoods()) {
    foodArray[i]=noms;
    i++;
  }
  if (foodArray[0].getNutrition() > foodArray[1].getNutrition()) {
    cooperateFood=foodArray[0];
    defectFood=foodArray[1];
  }
 else {
    cooperateFood=foodArray[1];
    defectFood=foodArray[0];
  }
switch (type) {
case AC:
    choice=cooperateFood;
  break;
case AD:
choice=defectFood;
break;
case R:
Random random=new Random();
if (random.nextInt(2) == 0) choice=cooperateFood;
 else choice=defectFood;
break;
case TFT:
List<String> members=this.getDataModel().getHuntingTeam().getMembers();
Food opponentPreviousChoice=cooperateFood;
if (members.size() == 1) {
choice=defectFood;
break;
}
if (members.get(0).equals(this.getId())) {
if (getConn().getAgentById(members.get(1)).getHuntingHistory().size() != 1) {
opponentPreviousChoice=getConn().getAgentById(members.get(1)).getHuntingHistory().getValue(1);
}
}
 else {
if (getConn().getAgentById(members.get(0)).getHuntingHistory().size() != 1) {
opponentPreviousChoice=getConn().getAgentById(members.get(0)).getHuntingHistory().getValue(1);
}
}
choice=opponentPreviousChoice;
break;
default :
throw new IllegalStateException("String_Node_Str");
}
return choice;
}
Program: 19803
Project: 19803
Buggy source:
@Override protected Food chooseFood(){
  Food bestSoFar=null;
  for (  Food noms : getConn().availableFoods()) {
    if (noms.getHuntersRequired() <= 1) {
      if (bestSoFar == null) {
        bestSoFar=noms;
      }
    }
    if (noms.getNutrition() > bestSoFar.getNutrition()) {
      bestSoFar=noms;
    }
  }
  return bestSoFar;
}

Fixed version (ground truth):
@Override protected Food chooseFood(){
  Food bestSoFar=null;
  for (  Food noms : getConn().availableFoods()) {
    if (noms.getHuntersRequired() <= 1) {
      if (bestSoFar == null) {
        bestSoFar=noms;
      }
 else {
        if (noms.getNutrition() > bestSoFar.getNutrition()) {
          bestSoFar=noms;
        }
      }
    }
  }
  return bestSoFar;
}
Program: 19804
Project: 19804
Buggy source:
public double getTrust(String agent){
  return source.getTrust(agent);
}

Fixed version (ground truth):
public Double getTrust(String agent){
  return source.getTrust(agent);
}
Program: 19805
Project: 19805
Buggy source:
private void processTeamHunts(){
  for (  HuntingTeam team : storedHuntResults.keySet()) {
    Map<Food,List<String>> hunters=new HashMap<Food,List<String>>();
    for (    TeamHuntEvent h : storedHuntResults.get(team)) {
      if (!hunters.containsKey(h.getFood())) {
        hunters.put(h.getFood(),new LinkedList<String>());
      }
      hunters.get(h.getFood()).add(h.getAgent());
    }
    for (    Food f : hunters.keySet()) {
      List<String> agents=hunters.get(f);
      double foodGained;
      int count=0;
      while ((count + 1) * f.getHuntersRequired() <= agents.size()) {
        ++count;
      }
      foodGained=count * f.getNutrition() / agents.size();
      String groupID=dmodel.getAgentById(agents.get(0)).getGroupId();
      Participant g=sim.getPlayer(groupID);
      for (      String agent : agents) {
        g.enqueueInput(new HuntResult(agent,foodGained,0,dmodel.time));
      }
    }
  }
  storedHuntResults.clear();
}

Fixed version (ground truth):
private void processTeamHunts(){
  for (  HuntingTeam team : storedHuntResults.keySet()) {
    Map<Food,List<String>> hunters=new HashMap<Food,List<String>>();
    for (    TeamHuntEvent h : storedHuntResults.get(team)) {
      if (!hunters.containsKey(h.getFood())) {
        hunters.put(h.getFood(),new LinkedList<String>());
      }
      hunters.get(h.getFood()).add(h.getAgent());
    }
    for (    Food f : hunters.keySet()) {
      List<String> agents=hunters.get(f);
      double foodGained;
      int count=0;
      while ((count + 1) * f.getHuntersRequired() <= agents.size()) {
        ++count;
      }
      foodGained=count * f.getNutrition() / agents.size();
      String groupID=dmodel.getAgentById(agents.get(0)).getGroupId();
      if (groupID == null) {
        for (        String agent : agents) {
          sim.getPlayer(agent).enqueueInput(new HuntResult(agent,foodGained,foodGained,dmodel.time));
        }
      }
 else {
        Participant g=sim.getPlayer(groupID);
        for (        String agent : agents) {
          g.enqueueInput(new HuntResult(agent,foodGained,0,dmodel.time));
        }
      }
    }
  }
  storedHuntResults.clear();
}
Program: 19806
Project: 19806
Buggy source:
@Override protected void updatePhysicalWorld(){
  processTeamHunts();
  if (fAGroup != null && dmodel.getTurnType() == TurnType.TeamSelect) {
    List<HuntingTeam> teams=fAGroup.selectTeams(dmodel.getUngroupedAgents());
    for (    HuntingTeam team : teams) {
      for (      String agent : team.getMembers()) {
        act(new GroupOrder(team,agent),getId(),authenticator.get(getId()));
      }
    }
  }
  if (dmodel.getTurnType() == TurnType.GoHunt) {
    for (    Participant agent : sim.players.values()) {
      if (sim.isParticipantActive(agent.getId())) {
        if (agent instanceof ise.gameoflife.participants.AbstractAgent) {
          agent.enqueueInput(new ConsumeFood(dmodel.getTime()));
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void updatePhysicalWorld(){
  processTeamHunts();
  if (fAGroup != null && dmodel.getTurnType() == TurnType.TeamSelect) {
    List<HuntingTeam> teams=fAGroup.selectTeams(dmodel.getUngroupedAgents());
    for (    HuntingTeam team : teams) {
      for (      String agent : team.getMembers()) {
        sim.getPlayer(agent).enqueueInput(new HuntOrder(sim.getTime(),team));
        log("String_Node_Str" + team.hashCode() + "String_Node_Str"+ nameOf(agent));
      }
    }
  }
  if (dmodel.getTurnType() == TurnType.GoHunt) {
    for (    Participant agent : sim.players.values()) {
      if (sim.isParticipantActive(agent.getId())) {
        if (agent instanceof ise.gameoflife.participants.AbstractAgent) {
          agent.enqueueInput(new ConsumeFood(dmodel.getTime()));
        }
      }
    }
  }
}
Program: 19807
Project: 19807
Buggy source:
@Override protected double updateLoyaltyAfterVotes(Proposition proposition,int votes,double overallMovement){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override protected double updateLoyaltyAfterVotes(Proposition proposition,int votes,double overallMovement){
  return 0;
}
Program: 19808
Project: 19808
Buggy source:
@Override protected double updateLoyaltyAfterHunt(double foodHunted,double foodReceived){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override protected double updateLoyaltyAfterHunt(double foodHunted,double foodReceived){
  return 0;
}