[Avida-SVN] r2881 - in branches/hjg-dev/source: cpu main

hjg at myxo.css.msu.edu hjg at myxo.css.msu.edu
Fri Oct 24 18:27:22 PDT 2008


Author: hjg
Date: 2008-10-24 21:27:22 -0400 (Fri, 24 Oct 2008)
New Revision: 2881

Modified:
   branches/hjg-dev/source/cpu/cHardwareCPU.cc
   branches/hjg-dev/source/main/cAvidaConfig.h
   branches/hjg-dev/source/main/cPopulationInterface.cc
Log:
new reputation strategy

Modified: branches/hjg-dev/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/hjg-dev/source/cpu/cHardwareCPU.cc	2008-10-24 20:10:44 UTC (rev 2880)
+++ branches/hjg-dev/source/cpu/cHardwareCPU.cc	2008-10-25 01:27:22 UTC (rev 2881)
@@ -6724,9 +6724,11 @@
 		// rotate recipient to face donor 
 		// by rotating until the recipient faces the donor
 		// adding a new comment.
-//		while (neighbor->GetNeighbor() != organism) {
-//			neighbor->Rotate(1);
-//		}
+		if (m_world->GetConfig().ROTATE_ON_DONATE.Get()) {
+			while (neighbor->GetNeighbor() != organism) {
+				neighbor->Rotate(1);
+			}
+		}
 		
 
 		// track stats
@@ -6745,12 +6747,18 @@
 			if (rep == 0) neighbor->SetReputation(-1);
 		} else if (m_world->GetConfig().AUTO_REPUTATION.Get() == 2) {
 			// reputation is proportional to how much you have donated/received
-		
 			int my_rep = organism->GetReputation();
 			organism->SetReputation(my_rep +1);
 			// get neighbor reputation
 			int rep = neighbor->GetReputation(); 
 			neighbor->SetReputation(rep-1);
+		} else if (m_world->GetConfig().AUTO_REPUTATION.Get() == 3)  {
+			// set rep to 1, since the organism donated
+			organism->SetReputation(1);
+			// get neighbor reputation
+			int rep = neighbor->GetReputation(); 
+			// if the organism has not yet donated, put it into bad standing
+			if (rep == 0) neighbor->SetReputation(-1);		
 		}
 		
 		

Modified: branches/hjg-dev/source/main/cAvidaConfig.h
===================================================================
--- branches/hjg-dev/source/main/cAvidaConfig.h	2008-10-24 20:10:44 UTC (rev 2880)
+++ branches/hjg-dev/source/main/cAvidaConfig.h	2008-10-25 01:27:22 UTC (rev 2881)
@@ -561,6 +561,7 @@
   CONFIG_ADD_VAR(AUTO_REPUTATION, int, 1, "Is an organism's reputation automatically computed based on its donations");
   CONFIG_ADD_VAR(OTHER_RAW_MAT_MULT, double, 1.00, "Number multiplied by the number of raw materials received from another organism to compute reward");
   CONFIG_ADD_VAR(MY_RAW_MAT_MULT, double, 1.00, "Number multiplied by the number of your raw materials");
+  CONFIG_ADD_VAR(ROTATE_ON_DONATE, int, 0, "Rotate an organism to face its donor 0/1 (off/on)");
 
   
 #endif

Modified: branches/hjg-dev/source/main/cPopulationInterface.cc
===================================================================
--- branches/hjg-dev/source/main/cPopulationInterface.cc	2008-10-24 20:10:44 UTC (rev 2880)
+++ branches/hjg-dev/source/main/cPopulationInterface.cc	2008-10-25 01:27:22 UTC (rev 2881)
@@ -363,7 +363,7 @@
 	// loop to face the max reputation
 	for (int i=0; i<k; i++) {
 				cell.ConnectionList().CircNext(); // or right...	
-				int test_rep = 	cell.ConnectionList().GetFirst()->GetOrganism()->GetReputation();
+//				int test_rep = 	cell.ConnectionList().GetFirst()->GetOrganism()->GetReputation();
 	}
 	
 }




More information about the Avida-cvs mailing list