[Avida-SVN] r2861 - branches/hjg-dev/source/main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Tue Oct 21 12:57:21 PDT 2008
Author: hjg
Date: 2008-10-21 15:57:21 -0400 (Tue, 21 Oct 2008)
New Revision: 2861
Modified:
branches/hjg-dev/source/main/cOrganism.cc
branches/hjg-dev/source/main/cTaskLib.cc
branches/hjg-dev/source/main/cTaskLib.h
Log:
bug fixes
Modified: branches/hjg-dev/source/main/cOrganism.cc
===================================================================
--- branches/hjg-dev/source/main/cOrganism.cc 2008-10-21 18:26:41 UTC (rev 2860)
+++ branches/hjg-dev/source/main/cOrganism.cc 2008-10-21 19:57:21 UTC (rev 2861)
@@ -815,7 +815,7 @@
indicates the organism never reciprocates and 10 indicates
the organism always reciprocates. */
void cOrganism::IncRecipProb() {
- if (m_recip_prob < 10) {
+// if (m_recip_prob < 10) {
m_recip_prob++;
if (m_recip_prob > m_max_recip_prob) m_max_recip_prob = m_recip_prob;
@@ -825,7 +825,7 @@
if (m_world->GetConfig().AUTO_REPUTATION.Get()) {
SetOpinion(m_recip_prob);
}
- }
+// }
}
/* Decrease an organism's probability of donating by 10%
@@ -833,7 +833,7 @@
indicates the organism never reciprocates and 10 indicates
the organism always reciprocates. */
void cOrganism::DecRecipProb() {
- if (m_recip_prob > 0) {
+// if (m_recip_prob > 0) {
m_recip_prob--;
if (m_recip_prob < m_min_recip_prob) m_min_recip_prob = m_recip_prob;
@@ -842,7 +842,7 @@
// reciprocity probability, then update the organism's opinion.
if (m_world->GetConfig().AUTO_REPUTATION.Get()) {
SetOpinion(m_recip_prob);
- }
+// }
}
}
Modified: branches/hjg-dev/source/main/cTaskLib.cc
===================================================================
--- branches/hjg-dev/source/main/cTaskLib.cc 2008-10-21 18:26:41 UTC (rev 2860)
+++ branches/hjg-dev/source/main/cTaskLib.cc 2008-10-21 19:57:21 UTC (rev 2861)
@@ -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 == "cont_use_raw_mat")
+ NewTask(name, "Control task for use raw mat", &cTaskLib::Task_UseRawMaterials);
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")
@@ -3070,17 +3072,26 @@
// For reputation-based work. See cOrganism.
-/* This task just checks that an organism has raw materials and that it has
- received a donation of raw materials from another organism.*/
+/* This task rewards an organism some for its own raw materials
+ and a multiplier * how many materials it has received from
+ others. */
double cTaskLib::Task_UseRawMaterials(cTaskContext& ctx) const {
double bonus = 0.0;
- if ((ctx.GetOrganism()->GetSelfRawMaterials() > 0) &&
- (ctx.GetOrganism()->GetOtherRawMaterials() > 0)) {
- bonus = ctx.GetOrganism()->GetOtherRawMaterials();
- }
+ double mult_val = m_world->GetConfig().OTHER_RAW_MAT_MULT.Get();
+
+ //if ((ctx.GetOrganism()->GetSelfRawMaterials() > 0) &&
+ //(ctx.GetOrganism()->GetOtherRawMaterials() > 0)) {
+
+ // reward for own stuff
+ bonus += ctx.GetOrganism()->GetSelfRawMaterials();
+ bonus += (mult_val * ctx.GetOrganism()->GetOtherRawMaterials());
+
+ //}
return bonus;
}
+
+
/* This task just checks that an organism has raw materials and that it has
received a donation of raw materials from another organism. Specifically,
the task rewards in proportion to the number of organisms that have
Modified: branches/hjg-dev/source/main/cTaskLib.h
===================================================================
--- branches/hjg-dev/source/main/cTaskLib.h 2008-10-21 18:26:41 UTC (rev 2860)
+++ branches/hjg-dev/source/main/cTaskLib.h 2008-10-21 19:57:21 UTC (rev 2861)
@@ -299,6 +299,7 @@
// reputation
double Task_UseRawMaterials(cTaskContext& ctx) const;
+ double Task_ControlUseRawMaterials(cTaskContext& ctx) const;
double Task_ConsumeRawMaterials(cTaskContext& ctx) const;
double Task_UseManyOrgsRawMaterials(cTaskContext& ctx) const;
More information about the Avida-cvs
mailing list