[Avida-SVN] r2902 - branches/hjg-dev/source/main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Thu Oct 30 20:07:53 PDT 2008
Author: hjg
Date: 2008-10-30 23:07:53 -0400 (Thu, 30 Oct 2008)
New Revision: 2902
Modified:
branches/hjg-dev/source/main/cAvidaConfig.h
branches/hjg-dev/source/main/cTaskLib.cc
branches/hjg-dev/source/main/cTaskLib.h
Log:
good reputation task
Modified: branches/hjg-dev/source/main/cAvidaConfig.h
===================================================================
--- branches/hjg-dev/source/main/cAvidaConfig.h 2008-10-31 02:03:43 UTC (rev 2901)
+++ branches/hjg-dev/source/main/cAvidaConfig.h 2008-10-31 03:07:53 UTC (rev 2902)
@@ -562,6 +562,7 @@
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)");
+ CONFIG_ADD_VAR(REPUTATION_REWARD, int, 0, "Reward an organism for having a good reputation");
#endif
Modified: branches/hjg-dev/source/main/cTaskLib.cc
===================================================================
--- branches/hjg-dev/source/main/cTaskLib.cc 2008-10-31 02:03:43 UTC (rev 2901)
+++ branches/hjg-dev/source/main/cTaskLib.cc 2008-10-31 03:07:53 UTC (rev 2902)
@@ -420,6 +420,8 @@
// reputation based tasks
else if(name == "use_raw_mat")
NewTask(name, "Use raw materials from self and other", &cTaskLib::Task_UseRawMaterials);
+ else if(name == "good_reputation")
+ NewTask(name, "Maintain a good reputation", &cTaskLib::Task_GoodReputation);
else if(name == "use_many_raw_mat")
NewTask(name, "Use raw materials from self and other", &cTaskLib::Task_UseManyOrgsRawMaterials);
else if(name == "consume_raw_mat")
@@ -3132,7 +3134,13 @@
return bonus;
}
+/* Reward organisms for having a good reputation */
+double cTaskLib::Task_GoodReputation(cTaskContext& ctx) const {
+// double bonus = 0.0;
+ int rep = ctx.GetOrganism()->GetReputation();
+ return (m_world->GetConfig().REPUTATION_REWARD.Get()*rep);
+}
Modified: branches/hjg-dev/source/main/cTaskLib.h
===================================================================
--- branches/hjg-dev/source/main/cTaskLib.h 2008-10-31 02:03:43 UTC (rev 2901)
+++ branches/hjg-dev/source/main/cTaskLib.h 2008-10-31 03:07:53 UTC (rev 2902)
@@ -299,6 +299,7 @@
// reputation
double Task_UseRawMaterials(cTaskContext& ctx) const;
+ double Task_GoodReputation(cTaskContext& ctx) const;
double Task_ConsumeRawMaterials(cTaskContext& ctx) const;
double Task_UseManyOrgsRawMaterials(cTaskContext& ctx) const;
More information about the Avida-cvs
mailing list