Program: 19659
Project: 19659
Buggy source:
/** 
 * This method updates the agent's trust value for its current opponent after hunt. 
 * @param foodHunted The amount of food the agent returned from hunting.
 * @param foodReceived The final amount of food the agent received after tax
 * @return A map entry containing the opponent's ID and the new trust value
 */
@Override protected Map<String,Double> updateTrustAfterHunt(double foodHunted,double foodReceived){
  String opponentID;
  Map<String,Double> newTrustValue=new HashMap<String,Double>();
  double trust;
  Food lastHunted=this.getDataModel().getLastHunted();
  if (this.getDataModel().getHuntingTeam() == null)   return null;
  List<String> members=this.getDataModel().getHuntingTeam().getMembers();
  if ((lastHunted == null) || (members.size() < 2))   return null;
  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.1;
  }
  if (lastHunted.getName().equals("String_Node_Str")) {
    if (foodHunted == 0) {
      trust=scale(trust,-1,randomGenerator.nextDouble());
    }
 else {
      trust=scale(trust,1,randomGenerator.nextDouble());
    }
  }
 else {
    trust=scale(trust,0,randomGenerator.nextDouble());
  }
  if (previousAdvisor != null) {
    double advisorTrust;
    if (getDataModel().getTrust(previousAdvisor) != null) {
      advisorTrust=getDataModel().getTrust(previousAdvisor);
    }
 else {
      advisorTrust=0.1;
    }
    if (foodHunted > 0) {
      advisorTrust=scale(advisorTrust,100,foodHunted);
    }
 else {
      advisorTrust=scale(advisorTrust,-100,foodHunted);
    }
    newTrustValue.put(previousAdvisor,advisorTrust);
  }
  newTrustValue.put(opponentID,trust);
  return newTrustValue;
}

Fixed version (ground truth):
/** 
 * This method updates the agent's trust value for its current opponent after hunt. 
 * @param foodHunted The amount of food the agent returned from hunting.
 * @param foodReceived The final amount of food the agent received after tax
 * @return A map entry containing the opponent's ID and the new trust value
 */
@Override protected Map<String,Double> updateTrustAfterHunt(double foodHunted,double foodReceived){
  String opponentID;
  Map<String,Double> newTrustValue=new HashMap<String,Double>();
  double trust;
  Food lastHunted=this.getDataModel().getLastHunted();
  if (this.getDataModel().getHuntingTeam() == null)   return null;
  List<String> members=this.getDataModel().getHuntingTeam().getMembers();
  if ((lastHunted == null) || (members.size() < 2))   return null;
  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.1;
  }
  if (lastHunted.getName().equals("String_Node_Str")) {
    if (foodHunted == 0) {
      trust=scale(trust,-1,randomGenerator.nextDouble());
    }
 else {
      trust=scale(trust,1,randomGenerator.nextDouble());
    }
  }
 else {
    trust=scale(trust,0,randomGenerator.nextDouble());
  }
  if (previousAdvisor != null) {
    double advisorTrust;
    if (getDataModel().getTrust(previousAdvisor) != null) {
      advisorTrust=getDataModel().getTrust(previousAdvisor);
    }
 else {
      advisorTrust=0.1;
    }
    if (foodHunted > 0) {
      advisorTrust=scale(advisorTrust,100,foodHunted);
    }
 else {
      advisorTrust=scale(advisorTrust,-100,foodHunted);
    }
    newTrustValue.put(previousAdvisor,advisorTrust);
    previousAdvisor=null;
  }
  newTrustValue.put(opponentID,trust);
  return newTrustValue;
}