[Avida-SVN] r1418 - branches/dkdev/source/main
dknoester at myxo.css.msu.edu
dknoester at myxo.css.msu.edu
Wed Mar 21 11:19:27 PDT 2007
Author: dknoester
Date: 2007-03-21 14:19:27 -0400 (Wed, 21 Mar 2007)
New Revision: 1418
Modified:
branches/dkdev/source/main/cAvidaConfig.h
branches/dkdev/source/main/cPopulation.cc
Log:
Added configuration option to randomize organism facing upon activation.
Modified: branches/dkdev/source/main/cAvidaConfig.h
===================================================================
--- branches/dkdev/source/main/cAvidaConfig.h 2007-03-20 20:16:16 UTC (rev 1417)
+++ branches/dkdev/source/main/cAvidaConfig.h 2007-03-21 18:19:27 UTC (rev 1418)
@@ -177,6 +177,7 @@
CONFIG_ADD_VAR(START_CREATURE, cString, "default-classic.org", "Organism to seed the soup");
CONFIG_ADD_GROUP(REPRODUCTION_GROUP, "Birth and Death");
+ CONFIG_ADD_VAR(RANDOMIZE_ORGANISM_FACING, int, 0, "Randomize the facing of offspring; 0=no.");
CONFIG_ADD_VAR(BIRTH_METHOD, int, 4, "0 = Replace random organism in neighborhood\n1 = Replace oldest organism in neighborhood\n2 = Replace largest Age/Merit in neighborhood\n3 = Place only in empty cells in neighborhood\n4 = Replace random from population (Mass Action)\n5 = Replace oldest in entire population (like Tierra)\n6 = Replace random within deme");
CONFIG_ADD_VAR(PREFER_EMPTY, int, 1, "Give empty cells preference in offsping placement?");
CONFIG_ADD_VAR(DEATH_METHOD, int, 2, "0 = Never die of old age.\n1 = Die when inst executed = AGE_LIMIT (+deviation)\n2 = Die when inst executed = length*AGE_LIMIT (+dev)");
Modified: branches/dkdev/source/main/cPopulation.cc
===================================================================
--- branches/dkdev/source/main/cPopulation.cc 2007-03-20 20:16:16 UTC (rev 1417)
+++ branches/dkdev/source/main/cPopulation.cc 2007-03-21 18:19:27 UTC (rev 1418)
@@ -233,7 +233,6 @@
}
-
// If we're not about to kill the parent, do some extra work on it.
if (parent_alive == true) {
// We're going to try something a little different here, and also take into
@@ -247,7 +246,7 @@
}
// In a local run, face the child toward the parent.
- if (m_world->GetConfig().BIRTH_METHOD.Get() < NUM_LOCAL_POSITION_CHILD) {
+ if(m_world->GetConfig().BIRTH_METHOD.Get() < NUM_LOCAL_POSITION_CHILD) {
for (int i = 0; i < child_array.GetSize(); i++) {
GetCell(target_cells[i]).Rotate(parent_cell);
}
@@ -344,7 +343,15 @@
// Update the contents of the target cell.
KillOrganism(target_cell);
target_cell.InsertOrganism(*in_organism);
-
+
+ // Randomize the facing of organisms if so configured.
+ if(m_world->GetConfig().RANDOMIZE_ORGANISM_FACING.Get()) {
+ int rotate_count=m_world->GetRandom().GetInt(0, target_cell.ConnectionList().GetSize());
+ for(int i=0; i<rotate_count; ++i) {
+ target_cell.ConnectionList().CircNext();
+ }
+ }
+
// Setup the inputs in the target cell.
environment.SetupInputs(ctx, target_cell.input_array);
More information about the Avida-cvs
mailing list