[Avida-cvs] [Avida2-svn] r211 - in trunk: documentation/content/using source/main
dule@myxo.css.msu.edu
dule at myxo.css.msu.edu
Sun Jun 19 15:16:53 PDT 2005
Author: dule
Date: 2005-06-19 18:16:53 -0400 (Sun, 19 Jun 2005)
New Revision: 211
Modified:
trunk/documentation/content/using/genesis.html
trunk/source/main/config.cc
trunk/source/main/config.hh
trunk/source/main/organism.cc
Log:
Added IMMUNITY_TASK setting to genesis. From the html docs:
Allows user to set the ID number for a task which, if it occures,
provides immunity from the required task (above) -- divide will
proceede even if the required task is not done if immunity task is done.
Defaults to -1, no immunity task present.
Modified: trunk/documentation/content/using/genesis.html
===================================================================
--- trunk/documentation/content/using/genesis.html 2005-06-17 21:27:53 UTC (rev 210)
+++ trunk/documentation/content/using/genesis.html 2005-06-19 22:16:53 UTC (rev 211)
@@ -161,6 +161,11 @@
At -1, no tasks are required. Ideally, this should be incorporated
into the environment configuration file. NOTE: A task can fire without
triggering a reaction. To add a required reaction see below.
+<tr><td valign=top><b><tt>IMMUNITY_TASK</tt></b>
+ <td>Allows user to set the ID number for a task which, if it occures,
+ provides immunity from the required task (above) -- divide will
+ proceede even if the required task is not done if immunity task is done.
+ Defaults to -1, no immunity task present.
<tr><td valign=top><b><tt>REQUIRED_REACTION</tt></b>
<td>Allows the user to set the ID number for a reaction that <i>must</i>
occur for a divide to be successful. At -1, no reactions are required.
Modified: trunk/source/main/config.cc
===================================================================
--- trunk/source/main/config.cc 2005-06-17 21:27:53 UTC (rev 210)
+++ trunk/source/main/config.cc 2005-06-19 22:16:53 UTC (rev 211)
@@ -78,6 +78,7 @@
int cConfig::alloc_method;
int cConfig::divide_method;
int cConfig::required_task;
+int cConfig::immunity_task;
int cConfig::required_reaction;
int cConfig::lineage_creation_method;
int cConfig::generation_inc_method;
@@ -207,6 +208,8 @@
"Is a an allocate required before a divide? (0/1)");
div_group->Add(required_task, "-1", "REQUIRED_TASK",
"Task ID required for successful divide.");
+ div_group->Add(immunity_task, "-1", "REQUIRED_TASK",
+ "Task providing immunity from the required task.");
div_group->Add(required_reaction, "-1", "REQUIRED_REACTION",
"Reaction ID required for successful divide.");
div_group->Add(die_prob, "0", "DIE_PROB",
Modified: trunk/source/main/config.hh
===================================================================
--- trunk/source/main/config.hh 2005-06-17 21:27:53 UTC (rev 210)
+++ trunk/source/main/config.hh 2005-06-19 22:16:53 UTC (rev 211)
@@ -242,6 +242,7 @@
static int two_fold_cost_sex;
static int same_length_sex;
static int required_task;
+ static int immunity_task;
static int required_reaction;
static int lineage_creation_method;
static int generation_inc_method;
@@ -384,6 +385,7 @@
static int GetTwoFoldCostSex() { return two_fold_cost_sex; }
static int GetSameLengthSex() { return same_length_sex; }
static int GetRequiredTask() { return required_task; }
+ static int GetImmunityTask() { return immunity_task; }
static int GetRequiredReaction() { return required_reaction; }
static int GetLineageCreationMethod() { return lineage_creation_method; }
static int GetGenerationIncMethod() { return generation_inc_method; }
Modified: trunk/source/main/organism.cc
===================================================================
--- trunk/source/main/organism.cc 2005-06-17 21:27:53 UTC (rev 210)
+++ trunk/source/main/organism.cc 2005-06-19 22:16:53 UTC (rev 211)
@@ -243,12 +243,16 @@
{
// Make sure required task (if any) has been performed...
const int required_task = cConfig::GetRequiredTask();
+ const int immunity_task = cConfig::GetImmunityTask();
if (required_task != -1 &&
- phenotype.GetCurTaskCount()[required_task] == 0) {
- Fault(FAULT_LOC_DIVIDE, FAULT_TYPE_ERROR,
- cStringUtil::Stringf("Lacks required task (%d)",
- cConfig::GetRequiredTask()));
- return false; // (divide fails)
+ phenotype.GetCurTaskCount()[required_task] == 0) {
+ if (immunity_task==-1 ||
+ phenotype.GetCurTaskCount()[immunity_task] == 0) {
+ Fault(FAULT_LOC_DIVIDE, FAULT_TYPE_ERROR,
+ cStringUtil::Stringf("Lacks required task (%d)",
+ cConfig::GetRequiredTask()));
+ return false; // (divide fails)
+ }
}
const int required_reaction = cConfig::GetRequiredReaction();
More information about the Avida-cvs
mailing list