[Avida-SVN] r2710 - branches/developers/avida-edward/source/python/AvidaGui2

kaben at myxo.css.msu.edu kaben at myxo.css.msu.edu
Fri Jul 4 02:21:22 PDT 2008


Author: kaben
Date: 2008-07-04 05:21:22 -0400 (Fri, 04 Jul 2008)
New Revision: 2710

Added:
   branches/developers/avida-edward/source/python/AvidaGui2/pyWriteAvidaCfgEvent.py
Removed:
   branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py
Modified:
   branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup.py
   branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup_utils.py
   branches/developers/avida-edward/source/python/AvidaGui2/app_pyuic
   branches/developers/avida-edward/source/python/AvidaGui2/pyAvida.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyAvidaCoreData.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyDefaultFiles.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyEduMainCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyEduMainMenuBarHdlr.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyTemporaryReloads.py
Log:
Avida-ED file names: now using "avida_cfg" naming convention.

    * This maintains compatibility with previously saved workspaces: if files with new naming convention can't be found, old convention will be tried.
    * I have not yet had the chance to rename c++ classes to use a similar naming convention.



Modified: branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup.py	2008-07-04 08:48:55 UTC (rev 2709)
+++ branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -1,20 +1,23 @@
 def NonInteractive():
   import sys
   import qt
+
   a = qt.QApplication(sys.argv)
+  default_font = qt.QFont("Arial", 12)
+  a.setFont(default_font, True)
+
   from AvidaGui2 import Avida_ED_startup_utils as Avida_ED_startup_utils
+
   Avida_ED_startup_utils.AvidaCore.cConfig.InitGroupList()
   ctrl = Avida_ED_startup_utils.AvidaEd()
-  default_font = qt.QFont("Arial", 12)
-  a.setFont(default_font, True)
   a.exec_loop()
 
 def Interactive():
   import IPython
   import __builtin__
 
-  startup_sequence = "import iqt; import AvidaGui2; from AvidaGui2.Avida_ED_startup_utils import *; AvidaCore.cConfig.InitGroupList(); avida_ed = AvidaEd();"
-  #startup_sequence = "import iqt; import AvidaGui2; from AvidaGui2.Avida_ED_startup_utils import *; AvidaCore.cConfig.InitGroupList();"
+  #startup_sequence = "import iqt; import AvidaGui2; from AvidaGui2.Avida_ED_startup_utils import *; AvidaCore.cConfig.InitGroupList(); avida_ed = AvidaEd();"
+  startup_sequence = "import iqt; import AvidaGui2; from AvidaGui2.Avida_ED_startup_utils import *; AvidaCore.cConfig.InitGroupList();"
 
   ipython_shell = IPython.Shell.IPShell(argv=["-c", startup_sequence])
   ipython_shell.mainloop()

Modified: branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup_utils.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup_utils.py	2008-07-04 08:48:55 UTC (rev 2709)
+++ branches/developers/avida-edward/source/python/AvidaGui2/Avida_ED_startup_utils.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -45,7 +45,13 @@
 # Instantiate (or reinstantiate) the Avida-ED gui. Return controller for
 # new gui instance.
 #
+#def AvidaEd_Disabled():
 def AvidaEd():
+  ## Enable the following two lines to redirect standard output and standard
+  ## error to the file "Avida-ED.log".
+  #sys.stdout = open("Avida-ED.log", 'w', 0)
+  #sys.stderr = sys.stdout
+
   sys.exc_clear()
   sys.exc_traceback = sys.last_traceback = None
   s_splash.message("Loading Avida-ED user-interface ...")
@@ -109,7 +115,7 @@
 
   avida = None
 
-  genesis_file_name = "./genesis.default"
+  avida_cfg_file_name = "./avida_cfg.default"
 
   try:
     Reload()
@@ -119,13 +125,13 @@
 
     os.chdir(os.path.join(res_dir, "console_work"))
     print "os.getcwd()", os.getcwd()
-    genesis = AvidaCore.cGenesis()
-    genesis.Open(AvidaCore.cString(genesis_file_name))
-    if 0 == genesis.IsOpen():
-      print "Unable to find file " + genesis_file_name
+    avida_cfg = AvidaCore.cGenesis()
+    avida_cfg.Open(AvidaCore.cString(avida_cfg_file_name))
+    if 0 == avida_cfg.IsOpen():
+      print "Unable to find file " + avida_cfg_file_name
       return None
     avida = pyAvida()
-    avida.construct(genesis)
+    avida.construct(avida_cfg)
 
   finally:
     s_splash.clear()
@@ -147,10 +153,9 @@
       avida.m_avida_threaded_driver.ProcessUpdate()
     os.rename('average.dat', 'average.dat.%d' % i)
 
-# Instantiate (or reinstantiate) the Avida-ED gui. Return controller for
-# new gui instance.
-#
-def AvidaEdDriverRefactor():
+# Instantiate (or reinstantiate) the Avida-ED gui.
+def AvidaEd_ExampleRunner():
+#def AvidaEd():
   sys.exc_clear()
   sys.exc_traceback = sys.last_traceback = None
   s_splash.message("Loading Avida-ED user-interface ...")
@@ -165,5 +170,6 @@
     s_splash.clear()
     s_splash.hide()
 
+  import examples
+
   return
-

Modified: branches/developers/avida-edward/source/python/AvidaGui2/app_pyuic
===================================================================
(Binary files differ)

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyAvida.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyAvida.py	2008-07-04 08:48:55 UTC (rev 2709)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyAvida.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -21,10 +21,10 @@
   def __init__(self):
     qt.QObject.__init__(self, None, self.__class__.__name__)
 
-  def construct(self, genesis):
-    self.m_name = genesis.GetFilename()
+  def construct(self, avida_cfg):
+    self.m_name = avida_cfg.GetFilename()
     self.m_environment = cEnvironment()
-    cConfig.Setup(genesis)
+    cConfig.Setup(avida_cfg)
     if 0 == self.m_environment.Load(cConfig.GetEnvironmentFilename()):
       print "Unable to load environment... aborting."
       self.m_population = None
@@ -62,7 +62,7 @@
     self.m_population = self.m_avida_threaded_driver.GetPopulation()
     descr("self.m_avida_threaded_driver.GetPopulation() done.")
 
-    self.m_name = genesis.GetFilename()
+    self.m_name = avida_cfg.GetFilename()
     self.m_avida_thread_mdtr = pyMdtr()
     self.m_should_update = False
 

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyAvidaCoreData.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyAvidaCoreData.py	2008-07-04 08:48:55 UTC (rev 2709)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyAvidaCoreData.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -3,20 +3,20 @@
 
 
 class pyAvidaCoreData:
-  def construct(self, genesis_filename):
-    self.m_genesis_filename = genesis_filename
+  def construct(self, avida_cfg_filename):
+    self.m_avida_cfg_filename = avida_cfg_filename
 
-    # Try to load a genesis file by name. Create the file if needed.
-    self.m_genesis = cGenesis()
-    self.m_genesis.Open(self.m_genesis_filename)
-    if 0 == self.m_genesis.IsOpen():
-      print("Warning: Unable to find file '", self.m_genesis_filename(), "'. Creating.")
-      cConfig.PrintGenesis(self.m_genesis_filename)
-      self.m_genesis.Open(self.m_genesis_filename)
+    # Try to load avida_cfg file by name. Create the file if needed.
+    self.m_avida_cfg = cGenesis()
+    self.m_avida_cfg.Open(self.m_avida_cfg_filename)
+    if 0 == self.m_avida_cfg.IsOpen():
+      print("Warning: Unable to find file '", self.m_avida_cfg_filename(), "'. Creating.")
+      cConfig.PrintGenesis(self.m_avida_cfg_filename)
+      self.m_avida_cfg.Open(self.m_avida_cfg_filename)
 
-    cConfig.Setup(self.m_genesis)
+    cConfig.Setup(self.m_avida_cfg)
     
-    # Try to load the environment file specified in the genesis file.
+    # Try to load the environment file specified in the avida_cfg file.
     self.m_environment = cEnvironment()
     if 0 == self.m_environment.Load(cConfig.GetEnvironmentFilename()):
       print("Unable to load environment... aborting!")
@@ -59,7 +59,7 @@
 
     class deleteChecks(pyTestCase):
       def test(self):
-        avida_core_data_factory = lambda : pyAvidaCoreData().construct(cString("genesis"))
+        avida_core_data_factory = lambda : pyAvidaCoreData().construct(cString("avida_cfg"))
         endotests = recursiveDeleteChecks(avida_core_data_factory, [])
         for (endotest, attr_name) in endotests:
           try:

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyDefaultFiles.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyDefaultFiles.py	2008-07-04 08:48:55 UTC (rev 2709)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyDefaultFiles.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -36,7 +36,7 @@
     lines = lines + ["events.default", "# basic syntax:  [trigger]  [start:interval:stop]  [event] [arguments...]"]
     lines = lines + ["events.default", "#"]
     lines = lines + ["events.default", "# This file is currently setup to start off a population full of the "]
-    lines = lines + ["events.default", "# starting organism specified in genesis, and then record key information"]
+    lines = lines + ["events.default", "# starting organism specified in avida_cfg, and then record key information"]
     lines = lines + ["events.default", "# every 100 updates."]
     lines = lines + ["events.default", "#"]
     lines = lines + ["events.default", "# For information on how to use this file, see:  doc/events.html"]
@@ -64,172 +64,171 @@
     lines = lines + ["events.default", "# u 50000:50000 detail_pop           # Save current state of population."]
     lines = lines + ["events.default", "# u 50000:50000 dump_historic_pop    # Save ancestors of current population."]
     lines = lines + ["events.default", ""]
-    lines = lines + ["genesis.default", "#############################################################################"]
-    lines = lines + ["genesis.default", "# This file includes all the basic run-time defines for avida."]
-    lines = lines + ["genesis.default", "# For more information, see doc/genesis.html"]
-    lines = lines + ["genesis.default", "#############################################################################"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "VERSION_ID 2.2.1		# Do not change this value!"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "### Architecture Variables ###"]
-    lines = lines + ["genesis.default", "MAX_UPDATES  -1         # Maximum updates to run simulation (-1 = no limit)"]
-    lines = lines + ["genesis.default", "MAX_GENERATIONS -1      # Maximum generations to run simulation (-1 = no limit)"]
-    lines = lines + ["genesis.default", "END_CONDITION_MODE 0	# End run when ..."]
-    lines = lines + ["genesis.default", "			# 0 = MAX_UPDATES _OR_ MAX_GENERATIONS is reached"]
-    lines = lines + ["genesis.default", "			# 1 = MAX_UPDATES _AND_ MAX_GENERATIONS is reached"]
-    lines = lines + ["genesis.default", "WORLD-X 30		# Width of the world in Avida mode."]
-    lines = lines + ["genesis.default", "WORLD-Y 30		# Height of the world in Avida mode."]
-    lines = lines + ["genesis.default", "WORLD_GEOMETRY 1        # 1 = Bounded Grid"]
-    lines = lines + ["genesis.default", "                        # 2 = Torus (Default)"]
-    lines = lines + ["genesis.default", "RANDOM_SEED 0		# Random number seed. (0 for based on time)"]
-    lines = lines + ["genesis.default", "HARDWARE_TYPE 0		# 0 = Original CPUs"]
-    lines = lines + ["genesis.default", "			# 1 = New, Stack-based CPUs"]
-    lines = lines + ["genesis.default", "MAX_CPU_THREADS 1	# Number of Threads CPUs can spawn"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "### Configuration Files ###"]
-    lines = lines + ["genesis.default", "DEFAULT_DIR ../work/              # Directory in which config files are found"]
-    lines = lines + ["genesis.default", "INST_SET inst_set.default         # File containing instruction set"]
-    lines = lines + ["genesis.default", "EVENT_FILE events.cfg             # File containing list of events during run"]
-    lines = lines + ["genesis.default", "ANALYZE_FILE analyze.cfg          # File used for analysis mode"]
-    lines = lines + ["genesis.default", "ENVIRONMENT_FILE environment.cfg  # File that describes the environment"]
-    lines = lines + ["genesis.default", "# START_CREATURE @ancestor.organism   # Organism to seed the soup"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "### Reproduction ###"]
-    lines = lines + ["genesis.default", "BIRTH_METHOD 4    # 0 = Replace random organism in neighborhood"]
-    lines = lines + ["genesis.default", "		  # 1 = Replace oldest organism in neighborhood"]
-    lines = lines + ["genesis.default", "		  # 2 = Replace largest Age/Merit in neighborhood"]
-    lines = lines + ["genesis.default", "		  # 3 = Place only in empty cells in neighborhood"]
-    lines = lines + ["genesis.default", "		  # 4 = Replace random from entire population (Mass Action)"]
-    lines = lines + ["genesis.default", "		  # 5 = Replace oldest in entire population (like Tierra)"]
-    lines = lines + ["genesis.default", "PREFER_EMPTY 1    # Are empty cells given preference in offspring placement?"]
-    lines = lines + ["genesis.default", "DEATH_METHOD 2    # 0 = Never die of old age."]
-    lines = lines + ["genesis.default", "		  # 1 = Die when inst executed = AGE_LIMIT (with deviation)"]
-    lines = lines + ["genesis.default", "		  # 2 = Die when inst executed = length * AGE_LIMIT (+ dev.)"]
-    lines = lines + ["genesis.default", "AGE_LIMIT 20      # Modifies DEATH_METHOD"]
-    lines = lines + ["genesis.default", "AGE_DEVIATION 0   # Modified DEATH_METHOD"]
-    lines = lines + ["genesis.default", "ALLOC_METHOD 0    # 0 = Allocated space is set to default instruction."]
-    lines = lines + ["genesis.default", "                  # 1 = Set to section of dead genome (Necrophilia)"]
-    lines = lines + ["genesis.default", "                  # 2 = Allocated space is set to random instruction."]
-    lines = lines + ["genesis.default", "DIVIDE_METHOD 1   # 0 = Divide leaves state of mother untouched."]
-    lines = lines + ["genesis.default", "                  # 1 = Divide resets state of mother"]
-    lines = lines + ["genesis.default", "                  #     (after the divide, we have 2 children)"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "GENERATION_INC_METHOD 1 # 0 = Only the generation of the child is"]
-    lines = lines + ["genesis.default", "                        #     increased on divide."]
-    lines = lines + ["genesis.default", "			# 1 = Both the generation of the mother and child are"]
-    lines = lines + ["genesis.default", "			#     increased on divide (good with DIVIDE_METHOD 1)."]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "### Divide Restrictions ####"]
-    lines = lines + ["genesis.default", "CHILD_SIZE_RANGE 1.0	# Maximal differential between child and parent sizes."]
-    lines = lines + ["genesis.default", "MIN_COPIED_LINES 0.5    # Code fraction which must be copied before divide."]
-    lines = lines + ["genesis.default", "MIN_EXE_LINES    0.5    # Code fraction which must be executed before divide."]
-    lines = lines + ["genesis.default", "REQUIRE_ALLOCATE   1    # Is a an allocate required before a divide? (0/1)"]
-    lines = lines + ["genesis.default", "REQUIRED_TASK -1  # Number of task required for successful divide."]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "### Mutations ###"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "# mutations that occur during execution.."]
-    lines = lines + ["genesis.default", "POINT_MUT_PROB  0.0     # Mutation rate (per-location per update)"]
-    lines = lines + ["genesis.default", "COPY_MUT_PROB   0.0075  # Mutation rate (per copy)."]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "# mutations that occur on divide..."]
-    lines = lines + ["genesis.default", "INS_MUT_PROB    0.0     # Insertion rate (per site, applied on divide)."]
-    lines = lines + ["genesis.default", "DEL_MUT_PROB    0.0     # Deletion rate (per site, applied on divide)."]
-    lines = lines + ["genesis.default", "DIV_MUT_PROB    0.0     # Mutation rate (per site, applied on divide)."]
-    lines = lines + ["genesis.default", "DIVIDE_MUT_PROB 0.0     # Mutation rate (per divide)."]
-    lines = lines + ["genesis.default", "DIVIDE_INS_PROB 0.0     # Insertion rate (per divide)."]
-    lines = lines + ["genesis.default", "DIVIDE_DEL_PROB 0.0     # Deletion rate (per divide)."]
-    lines = lines + ["genesis.default", "PARENT_MUT_PROB 0.0     # Per-site, in parent, on divide"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "# heads based mutations"]
-    lines = lines + ["genesis.default", "# READ_SHIFT_PROB   0.0"]
-    lines = lines + ["genesis.default", "# READ INS_PROB     0.0"]
-    lines = lines + ["genesis.default", "# READ_DEL_PROB     0.0"]
-    lines = lines + ["genesis.default", "# WRITE_SHIFT_PROB  0.0"]
-    lines = lines + ["genesis.default", "# WRITE_INS_PROB    0.0"]
-    lines = lines + ["genesis.default", "# WRITE_DEL_PROB    0.0"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "### Mutation reversions ###"]
-    lines = lines + ["genesis.default", "# these slow down avida a lot, and should be set to 0 normally."]
-    lines = lines + ["genesis.default", "REVERT_FATAL       0.0  # Should any mutations be reverted on birth?"]
-    lines = lines + ["genesis.default", "REVERT_DETRIMENTAL 0.0  #   0.0 to 1.0; Probability of reversion."]
-    lines = lines + ["genesis.default", "REVERT_NEUTRAL     0.0"]
-    lines = lines + ["genesis.default", "REVERT_BENEFICIAL  0.0"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "STERILIZE_FATAL       0.0  # Should any mutations clear (kill) the organism?"]
-    lines = lines + ["genesis.default", "STERILIZE_DETRIMENTAL 0.0  #   0.0 to 1.0; Probability of reset."]
-    lines = lines + ["genesis.default", "STERILIZE_NEUTRAL     0.0"]
-    lines = lines + ["genesis.default", "STERILIZE_BENEFICIAL  0.0"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "FAIL_IMPLICIT     0	# Should copies that failed *not* due to mutations"]
-    lines = lines + ["genesis.default", "			# be eliminated?"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "### Time Slicing ###"]
-    lines = lines + ["genesis.default", "AVE_TIME_SLICE 30"]
-    lines = lines + ["genesis.default", "SLICING_METHOD 2	# 0 = CONSTANT: all organisms get default..."]
-    lines = lines + ["genesis.default", "			# 1 = PROBABILISTIC: Run _prob_ proportional to merit."]
-    lines = lines + ["genesis.default", "			# 2 = INTEGRATED: Perfectly integrated deterministic."]
-    lines = lines + ["genesis.default", "SIZE_MERIT_METHOD 4	# 0 = off (merit is independent of size)"]
-    lines = lines + ["genesis.default", "			# 1 = Merit proportional to copied size"]
-    lines = lines + ["genesis.default", "			# 2 = Merit prop. to executed size"]
-    lines = lines + ["genesis.default", "			# 3 = Merit prop. to full size"]
-    lines = lines + ["genesis.default", "			# 4 = Merit prop. to min of executed or copied size"]
-    lines = lines + ["genesis.default", "			# 5 = Merit prop. to sqrt of the minimum size"]
-    lines = lines + ["genesis.default", "TASK_MERIT_METHOD 1	# 0 = No task bonuses"]
-    lines = lines + ["genesis.default", "			# 1 = Bonus just equals the task bonus"]
-    lines = lines + ["genesis.default", "THREAD_SLICING_METHOD 0 # 0 = One thread executed per time slice."]
-    lines = lines + ["genesis.default", "			# 1 = All threads executed each time slice."]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "MAX_LABEL_EXE_SIZE 1	# Max nops marked as executed when labels are used"]
-    lines = lines + ["genesis.default", "MERIT_TIME 1            # 0 = Merit Calculated when task completed"]
-    lines = lines + ["genesis.default", "		        # 1 = Merit Calculated on Divide"]
-    lines = lines + ["genesis.default", "MAX_NUM_TASKS_REWARDED -1  # -1 = Unlimited"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "### Genotype Info ###"]
-    lines = lines + ["genesis.default", "THRESHOLD 1		# Number of organisms in a genotype needed for it"]
-    lines = lines + ["genesis.default", "			#   to be considered viable."]
-    lines = lines + ["genesis.default", "GENOTYPE_PRINT 0	# 0/1 (off/on) Print out all threshold genotypes?"]
-    lines = lines + ["genesis.default", "GENOTYPE_PRINT_DOM 0	# Print out a genotype if it stays dominant for"]
-    lines = lines + ["genesis.default", "                        #   this many updates. (0 = off)"]
-    lines = lines + ["genesis.default", "SPECIES_THRESHOLD 2     # max failure count for organisms to be same species"]
-    lines = lines + ["genesis.default", "SPECIES_RECORDING 0	# 1 = full, 2 = limited search (parent only)"]
-    lines = lines + ["genesis.default", "SPECIES_PRINT 0		# 0/1 (off/on) Print out all species?"]
-    lines = lines + ["genesis.default", "TEST_CPU_TIME_MOD 20    # Time allocated in test CPUs (multiple of length)"]
-    lines = lines + ["genesis.default", "TRACK_MAIN_LINEAGE 1    # Track primary lineage leading to final population?"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "### Log Files ###"]
-    lines = lines + ["genesis.default", "LOG_CREATURES 0		# 0/1 (off/on) toggle to print file."]
-    lines = lines + ["genesis.default", "LOG_GENOTYPES 0		# 0 = off, 1 = print ALL, 2 = print threshold ONLY."]
-    lines = lines + ["genesis.default", "LOG_THRESHOLD 0		# 0/1 (off/on) toggle to print file."]
-    lines = lines + ["genesis.default", "LOG_SPECIES 0		# 0/1 (off/on) toggle to print file."]
-    lines = lines + ["genesis.default", "LOG_LANDSCAPE 0		# 0/1 (off/on) toggle to print file."]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "LOG_LINEAGES 1          # 0/1 (off/on) to log advantageous mutations"]
-    lines = lines + ["genesis.default", "# This one can slow down avida a lot. It is used to get an idea of how"]
-    lines = lines + ["genesis.default", "# often an advantageous mutation arises, and where it goes afterwards."]
-    lines = lines + ["genesis.default", "# See also LINEAGE_CREATION_METHOD."]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "LINEAGE_CREATION_METHOD 0"]
-    lines = lines + ["genesis.default", "# Lineage creation options are.  Works only when LOG_LINEAGES is set to 1."]
-    lines = lines + ["genesis.default", "#   0 = manual creation (on inject, use successive integers as lineage labels)."]
-    lines = lines + ["genesis.default", "#   1 = when a child's (potential) fitness is higher than that of its parent."]
-    lines = lines + ["genesis.default", "#   2 = when a child's (potential) fitness is higher than max in population."]
-    lines = lines + ["genesis.default", "#   3 = when a child's (potential) fitness is higher than max in dom. lineage"]
-    lines = lines + ["genesis.default", "#	*and* the child is in the dominant lineage, or (2)"]
-    lines = lines + ["genesis.default", "#   4 = when a child's (potential) fitness is higher than max in dom. lineage"]
-    lines = lines + ["genesis.default", "#	(and that of its own lineage)"]
-    lines = lines + ["genesis.default", "#   5 = same as child's (potential) fitness is higher than that of the"]
-    lines = lines + ["genesis.default", "#       currently dominant organism, and also than that of any organism"]
-    lines = lines + ["genesis.default", "#       currently in the same lineage."]
-    lines = lines + ["genesis.default", "#   6 = when a child's (potential) fitness is higher than any organism"]
-    lines = lines + ["genesis.default", "#       currently in the same lineage."]
-    lines = lines + ["genesis.default", "#   7 = when a child's (potential) fitness is higher than that of any"]
-    lines = lines + ["genesis.default", "#       organism in its line of descent"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", "### END ###"]
-    lines = lines + ["genesis.default", ""]
-    lines = lines + ["genesis.default", ""]
+    lines = lines + ["avida_cfg.default", "#############################################################################"]
+    lines = lines + ["avida_cfg.default", "# This file includes all the basic run-time defines for avida."]
+    lines = lines + ["avida_cfg.default", "#############################################################################"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "VERSION_ID 2.2.1		# Do not change this value!"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "### Architecture Variables ###"]
+    lines = lines + ["avida_cfg.default", "MAX_UPDATES  -1         # Maximum updates to run simulation (-1 = no limit)"]
+    lines = lines + ["avida_cfg.default", "MAX_GENERATIONS -1      # Maximum generations to run simulation (-1 = no limit)"]
+    lines = lines + ["avida_cfg.default", "END_CONDITION_MODE 0	# End run when ..."]
+    lines = lines + ["avida_cfg.default", "			# 0 = MAX_UPDATES _OR_ MAX_GENERATIONS is reached"]
+    lines = lines + ["avida_cfg.default", "			# 1 = MAX_UPDATES _AND_ MAX_GENERATIONS is reached"]
+    lines = lines + ["avida_cfg.default", "WORLD-X 30		# Width of the world in Avida mode."]
+    lines = lines + ["avida_cfg.default", "WORLD-Y 30		# Height of the world in Avida mode."]
+    lines = lines + ["avida_cfg.default", "WORLD_GEOMETRY 1        # 1 = Bounded Grid"]
+    lines = lines + ["avida_cfg.default", "                        # 2 = Torus (Default)"]
+    lines = lines + ["avida_cfg.default", "RANDOM_SEED 0		# Random number seed. (0 for based on time)"]
+    lines = lines + ["avida_cfg.default", "HARDWARE_TYPE 0		# 0 = Original CPUs"]
+    lines = lines + ["avida_cfg.default", "			# 1 = New, Stack-based CPUs"]
+    lines = lines + ["avida_cfg.default", "MAX_CPU_THREADS 1	# Number of Threads CPUs can spawn"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "### Configuration Files ###"]
+    lines = lines + ["avida_cfg.default", "DEFAULT_DIR ../work/              # Directory in which config files are found"]
+    lines = lines + ["avida_cfg.default", "INST_SET inst_set.default         # File containing instruction set"]
+    lines = lines + ["avida_cfg.default", "EVENT_FILE events.cfg             # File containing list of events during run"]
+    lines = lines + ["avida_cfg.default", "ANALYZE_FILE analyze.cfg          # File used for analysis mode"]
+    lines = lines + ["avida_cfg.default", "ENVIRONMENT_FILE environment.cfg  # File that describes the environment"]
+    lines = lines + ["avida_cfg.default", "# START_CREATURE @ancestor.organism   # Organism to seed the soup"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "### Reproduction ###"]
+    lines = lines + ["avida_cfg.default", "BIRTH_METHOD 4    # 0 = Replace random organism in neighborhood"]
+    lines = lines + ["avida_cfg.default", "		  # 1 = Replace oldest organism in neighborhood"]
+    lines = lines + ["avida_cfg.default", "		  # 2 = Replace largest Age/Merit in neighborhood"]
+    lines = lines + ["avida_cfg.default", "		  # 3 = Place only in empty cells in neighborhood"]
+    lines = lines + ["avida_cfg.default", "		  # 4 = Replace random from entire population (Mass Action)"]
+    lines = lines + ["avida_cfg.default", "		  # 5 = Replace oldest in entire population (like Tierra)"]
+    lines = lines + ["avida_cfg.default", "PREFER_EMPTY 1    # Are empty cells given preference in offspring placement?"]
+    lines = lines + ["avida_cfg.default", "DEATH_METHOD 2    # 0 = Never die of old age."]
+    lines = lines + ["avida_cfg.default", "		  # 1 = Die when inst executed = AGE_LIMIT (with deviation)"]
+    lines = lines + ["avida_cfg.default", "		  # 2 = Die when inst executed = length * AGE_LIMIT (+ dev.)"]
+    lines = lines + ["avida_cfg.default", "AGE_LIMIT 20      # Modifies DEATH_METHOD"]
+    lines = lines + ["avida_cfg.default", "AGE_DEVIATION 0   # Modified DEATH_METHOD"]
+    lines = lines + ["avida_cfg.default", "ALLOC_METHOD 0    # 0 = Allocated space is set to default instruction."]
+    lines = lines + ["avida_cfg.default", "                  # 1 = Set to section of dead genome (Necrophilia)"]
+    lines = lines + ["avida_cfg.default", "                  # 2 = Allocated space is set to random instruction."]
+    lines = lines + ["avida_cfg.default", "DIVIDE_METHOD 1   # 0 = Divide leaves state of mother untouched."]
+    lines = lines + ["avida_cfg.default", "                  # 1 = Divide resets state of mother"]
+    lines = lines + ["avida_cfg.default", "                  #     (after the divide, we have 2 children)"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "GENERATION_INC_METHOD 1 # 0 = Only the generation of the child is"]
+    lines = lines + ["avida_cfg.default", "                        #     increased on divide."]
+    lines = lines + ["avida_cfg.default", "			# 1 = Both the generation of the mother and child are"]
+    lines = lines + ["avida_cfg.default", "			#     increased on divide (good with DIVIDE_METHOD 1)."]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "### Divide Restrictions ####"]
+    lines = lines + ["avida_cfg.default", "CHILD_SIZE_RANGE 1.0	# Maximal differential between child and parent sizes."]
+    lines = lines + ["avida_cfg.default", "MIN_COPIED_LINES 0.5    # Code fraction which must be copied before divide."]
+    lines = lines + ["avida_cfg.default", "MIN_EXE_LINES    0.5    # Code fraction which must be executed before divide."]
+    lines = lines + ["avida_cfg.default", "REQUIRE_ALLOCATE   1    # Is a an allocate required before a divide? (0/1)"]
+    lines = lines + ["avida_cfg.default", "REQUIRED_TASK -1  # Number of task required for successful divide."]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "### Mutations ###"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "# mutations that occur during execution.."]
+    lines = lines + ["avida_cfg.default", "POINT_MUT_PROB  0.0     # Mutation rate (per-location per update)"]
+    lines = lines + ["avida_cfg.default", "COPY_MUT_PROB   0.0075  # Mutation rate (per copy)."]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "# mutations that occur on divide..."]
+    lines = lines + ["avida_cfg.default", "INS_MUT_PROB    0.0     # Insertion rate (per site, applied on divide)."]
+    lines = lines + ["avida_cfg.default", "DEL_MUT_PROB    0.0     # Deletion rate (per site, applied on divide)."]
+    lines = lines + ["avida_cfg.default", "DIV_MUT_PROB    0.0     # Mutation rate (per site, applied on divide)."]
+    lines = lines + ["avida_cfg.default", "DIVIDE_MUT_PROB 0.0     # Mutation rate (per divide)."]
+    lines = lines + ["avida_cfg.default", "DIVIDE_INS_PROB 0.0     # Insertion rate (per divide)."]
+    lines = lines + ["avida_cfg.default", "DIVIDE_DEL_PROB 0.0     # Deletion rate (per divide)."]
+    lines = lines + ["avida_cfg.default", "PARENT_MUT_PROB 0.0     # Per-site, in parent, on divide"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "# heads based mutations"]
+    lines = lines + ["avida_cfg.default", "# READ_SHIFT_PROB   0.0"]
+    lines = lines + ["avida_cfg.default", "# READ INS_PROB     0.0"]
+    lines = lines + ["avida_cfg.default", "# READ_DEL_PROB     0.0"]
+    lines = lines + ["avida_cfg.default", "# WRITE_SHIFT_PROB  0.0"]
+    lines = lines + ["avida_cfg.default", "# WRITE_INS_PROB    0.0"]
+    lines = lines + ["avida_cfg.default", "# WRITE_DEL_PROB    0.0"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "### Mutation reversions ###"]
+    lines = lines + ["avida_cfg.default", "# these slow down avida a lot, and should be set to 0 normally."]
+    lines = lines + ["avida_cfg.default", "REVERT_FATAL       0.0  # Should any mutations be reverted on birth?"]
+    lines = lines + ["avida_cfg.default", "REVERT_DETRIMENTAL 0.0  #   0.0 to 1.0; Probability of reversion."]
+    lines = lines + ["avida_cfg.default", "REVERT_NEUTRAL     0.0"]
+    lines = lines + ["avida_cfg.default", "REVERT_BENEFICIAL  0.0"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "STERILIZE_FATAL       0.0  # Should any mutations clear (kill) the organism?"]
+    lines = lines + ["avida_cfg.default", "STERILIZE_DETRIMENTAL 0.0  #   0.0 to 1.0; Probability of reset."]
+    lines = lines + ["avida_cfg.default", "STERILIZE_NEUTRAL     0.0"]
+    lines = lines + ["avida_cfg.default", "STERILIZE_BENEFICIAL  0.0"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "FAIL_IMPLICIT     0	# Should copies that failed *not* due to mutations"]
+    lines = lines + ["avida_cfg.default", "			# be eliminated?"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "### Time Slicing ###"]
+    lines = lines + ["avida_cfg.default", "AVE_TIME_SLICE 30"]
+    lines = lines + ["avida_cfg.default", "SLICING_METHOD 2	# 0 = CONSTANT: all organisms get default..."]
+    lines = lines + ["avida_cfg.default", "			# 1 = PROBABILISTIC: Run _prob_ proportional to merit."]
+    lines = lines + ["avida_cfg.default", "			# 2 = INTEGRATED: Perfectly integrated deterministic."]
+    lines = lines + ["avida_cfg.default", "SIZE_MERIT_METHOD 4	# 0 = off (merit is independent of size)"]
+    lines = lines + ["avida_cfg.default", "			# 1 = Merit proportional to copied size"]
+    lines = lines + ["avida_cfg.default", "			# 2 = Merit prop. to executed size"]
+    lines = lines + ["avida_cfg.default", "			# 3 = Merit prop. to full size"]
+    lines = lines + ["avida_cfg.default", "			# 4 = Merit prop. to min of executed or copied size"]
+    lines = lines + ["avida_cfg.default", "			# 5 = Merit prop. to sqrt of the minimum size"]
+    lines = lines + ["avida_cfg.default", "TASK_MERIT_METHOD 1	# 0 = No task bonuses"]
+    lines = lines + ["avida_cfg.default", "			# 1 = Bonus just equals the task bonus"]
+    lines = lines + ["avida_cfg.default", "THREAD_SLICING_METHOD 0 # 0 = One thread executed per time slice."]
+    lines = lines + ["avida_cfg.default", "			# 1 = All threads executed each time slice."]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "MAX_LABEL_EXE_SIZE 1	# Max nops marked as executed when labels are used"]
+    lines = lines + ["avida_cfg.default", "MERIT_TIME 1            # 0 = Merit Calculated when task completed"]
+    lines = lines + ["avida_cfg.default", "		        # 1 = Merit Calculated on Divide"]
+    lines = lines + ["avida_cfg.default", "MAX_NUM_TASKS_REWARDED -1  # -1 = Unlimited"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "### Genotype Info ###"]
+    lines = lines + ["avida_cfg.default", "THRESHOLD 1		# Number of organisms in a genotype needed for it"]
+    lines = lines + ["avida_cfg.default", "			#   to be considered viable."]
+    lines = lines + ["avida_cfg.default", "GENOTYPE_PRINT 0	# 0/1 (off/on) Print out all threshold genotypes?"]
+    lines = lines + ["avida_cfg.default", "GENOTYPE_PRINT_DOM 0	# Print out a genotype if it stays dominant for"]
+    lines = lines + ["avida_cfg.default", "                        #   this many updates. (0 = off)"]
+    lines = lines + ["avida_cfg.default", "SPECIES_THRESHOLD 2     # max failure count for organisms to be same species"]
+    lines = lines + ["avida_cfg.default", "SPECIES_RECORDING 0	# 1 = full, 2 = limited search (parent only)"]
+    lines = lines + ["avida_cfg.default", "SPECIES_PRINT 0		# 0/1 (off/on) Print out all species?"]
+    lines = lines + ["avida_cfg.default", "TEST_CPU_TIME_MOD 20    # Time allocated in test CPUs (multiple of length)"]
+    lines = lines + ["avida_cfg.default", "TRACK_MAIN_LINEAGE 1    # Track primary lineage leading to final population?"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "### Log Files ###"]
+    lines = lines + ["avida_cfg.default", "LOG_CREATURES 0		# 0/1 (off/on) toggle to print file."]
+    lines = lines + ["avida_cfg.default", "LOG_GENOTYPES 0		# 0 = off, 1 = print ALL, 2 = print threshold ONLY."]
+    lines = lines + ["avida_cfg.default", "LOG_THRESHOLD 0		# 0/1 (off/on) toggle to print file."]
+    lines = lines + ["avida_cfg.default", "LOG_SPECIES 0		# 0/1 (off/on) toggle to print file."]
+    lines = lines + ["avida_cfg.default", "LOG_LANDSCAPE 0		# 0/1 (off/on) toggle to print file."]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "LOG_LINEAGES 1          # 0/1 (off/on) to log advantageous mutations"]
+    lines = lines + ["avida_cfg.default", "# This one can slow down avida a lot. It is used to get an idea of how"]
+    lines = lines + ["avida_cfg.default", "# often an advantageous mutation arises, and where it goes afterwards."]
+    lines = lines + ["avida_cfg.default", "# See also LINEAGE_CREATION_METHOD."]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "LINEAGE_CREATION_METHOD 0"]
+    lines = lines + ["avida_cfg.default", "# Lineage creation options are.  Works only when LOG_LINEAGES is set to 1."]
+    lines = lines + ["avida_cfg.default", "#   0 = manual creation (on inject, use successive integers as lineage labels)."]
+    lines = lines + ["avida_cfg.default", "#   1 = when a child's (potential) fitness is higher than that of its parent."]
+    lines = lines + ["avida_cfg.default", "#   2 = when a child's (potential) fitness is higher than max in population."]
+    lines = lines + ["avida_cfg.default", "#   3 = when a child's (potential) fitness is higher than max in dom. lineage"]
+    lines = lines + ["avida_cfg.default", "#	*and* the child is in the dominant lineage, or (2)"]
+    lines = lines + ["avida_cfg.default", "#   4 = when a child's (potential) fitness is higher than max in dom. lineage"]
+    lines = lines + ["avida_cfg.default", "#	(and that of its own lineage)"]
+    lines = lines + ["avida_cfg.default", "#   5 = same as child's (potential) fitness is higher than that of the"]
+    lines = lines + ["avida_cfg.default", "#       currently dominant organism, and also than that of any organism"]
+    lines = lines + ["avida_cfg.default", "#       currently in the same lineage."]
+    lines = lines + ["avida_cfg.default", "#   6 = when a child's (potential) fitness is higher than any organism"]
+    lines = lines + ["avida_cfg.default", "#       currently in the same lineage."]
+    lines = lines + ["avida_cfg.default", "#   7 = when a child's (potential) fitness is higher than that of any"]
+    lines = lines + ["avida_cfg.default", "#       organism in its line of descent"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", "### END ###"]
+    lines = lines + ["avida_cfg.default", ""]
+    lines = lines + ["avida_cfg.default", ""]
     lines = lines + ["inst_set.default", "nop-A      1   # a"]
     lines = lines + ["inst_set.default", "nop-B      1   # b"]
     lines = lines + ["inst_set.default", "nop-C      1   # c"]

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyEduMainCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyEduMainCtrl.py	2008-07-04 08:48:55 UTC (rev 2709)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyEduMainCtrl.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -88,7 +88,7 @@
           edu_main_ctrl.construct()
           edu_main_ctrl.m_main_mdl.m_main_mdtr.m_main_controller_factory_mdtr.emit(
             qt.PYSIGNAL("newMainControllerSig"),
-            ("pySessionCtrl", cString("genesis.avida"), ))
+            ("pySessionCtrl", cString("avida_cfg.avida"), ))
           return edu_main_ctrl
 
         print """

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyEduMainMenuBarHdlr.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyEduMainMenuBarHdlr.py	2008-07-04 08:48:55 UTC (rev 2709)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyEduMainMenuBarHdlr.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -168,17 +168,17 @@
   def doOpenWorkspaceSlot(self):
     print "pyEduMainMenuBarHdlr.doOpenWorkspaceSlot()..."
     qt.QMessageBox.warning(
-      None, "Watch out...", "We aren't yet checking genesis files for errors, so beware.", qt.QMessageBox.Ok, 0)
-    genesis_filename = qt.QFileDialog.getOpenFileName(
-      ".", "Avida Config FIles (*.avida)", None, "Temporary open file dialog", "Choose a Genesis File" )
-    if genesis_filename.isEmpty():
-      print "pyEduMainMenuBarHdlr.doOpenWorkspaceSlot() genesis_filename was empty."
+      None, "Watch out...", "We aren't yet checking avida_cfg files for errors, so beware.", qt.QMessageBox.Ok, 0)
+    avida_cfg_filename = qt.QFileDialog.getOpenFileName(
+      ".", "Avida Config FIles (*.avida)", None, "Temporary open file dialog", "Choose an Avida Configuration File" )
+    if avida_cfg_filename.isEmpty():
+      print "pyEduMainMenuBarHdlr.doOpenWorkspaceSlot() avida_cfg_filename was empty."
     else:
-      print "pyEduMainMenuBarHdlr.doOpenWorkspaceSlot() genesis_filename: '" + str(genesis_filename) + "'"
+      print "pyEduMainMenuBarHdlr.doOpenWorkspaceSlot() avida_cfg_filename: '" + str(avida_cfg_filename) + "'"
       self.m_main_mdl.m_main_mdtr.m_main_controller_factory_mdtr.emit(
-        qt.PYSIGNAL("newMainControllerSig"), ("pySessionCtrl", cString(str(genesis_filename)), ))
+        qt.PYSIGNAL("newMainControllerSig"), ("pySessionCtrl", cString(str(avida_cfg_filename)), ))
       #session_ctrl = pySessionCtrl(self.main_mdl)
-      #session_ctrl.m_session_mdl.m_genesis_filename = cString(str(genesis_filename))
+      #session_ctrl.m_session_mdl.m_avida_cfg_filename = cString(str(avida_cfg_filename))
       #session_ctrl.construct()
       #self.m_main_mdl.m_main_controllers_list.append(session_ctrl)
     print "pyEduMainMenuBarHdlr.doOpenWorkspaceSlot() done."

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py	2008-07-04 08:48:55 UTC (rev 2709)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyEduWorkspaceCtrl.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -297,7 +297,7 @@
             os.mkdir(os.path.join(new_dir,"freezer"))
             os.mkdir(os.path.join(new_dir,"freezer","@example.full"))
             filesToCopy = ["environment.default", "inst_set.default", 
-                           "events.default", "genesis.default", 
+                           "events.default", "avida_cfg.default", 
                            os.path.join("freezer", "@example.empty"), 
                            os.path.join("freezer", "@ancestor.organism"),
                      os.path.join("freezer", "@example.full", "average.dat"),

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py	2008-07-04 08:48:55 UTC (rev 2709)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyPetriConfigureCtrl.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -5,7 +5,7 @@
 from pyAvida import pyAvida
 from pyFreezeDialogCtrl import pyFreezeDialogCtrl
 from pyPetriConfigureView import pyPetriConfigureView
-from pyWriteGenesisEvent import pyWriteGenesisEvent
+from pyWriteAvidaCfgEvent import pyWriteAvidaCfgEvent
 from pyWriteToFreezer import pyWriteToFreezer
 from pyReadFreezer import pyReadFreezer
 from pyNewIconView import pyNewIconViewItem
@@ -452,14 +452,14 @@
     # (ie saved)
 
     self.full_petri_dict["SETTINGS"] = self.Form2Dictionary()
-    write_object = pyWriteGenesisEvent(self.full_petri_dict,
+    write_object = pyWriteAvidaCfgEvent(self.full_petri_dict,
       self.m_session_mdl, 
       self.m_session_mdl.m_current_workspace,
       self.m_session_mdl.m_current_freezer, self.m_session_mdl.m_tempdir,
       self.m_session_mdl.m_tempdir_out)
     self.m_session_mdl.m_session_mdtr.emit(
       PYSIGNAL("doInitializeAvidaPhaseIISig"), 
-      (os.path.join(self.m_session_mdl.m_tempdir, "genesis.avida"),))
+      (os.path.join(self.m_session_mdl.m_tempdir, "avida_cfg.avida"),))
       
   def Form2Dictionary(self):
     settings_dict = {}
@@ -594,17 +594,17 @@
 
   # Routine to load data from Avida-ED into Avida Core
 
-  def doLoadPetriDishConfigFileSlot(self, genesisFileName = None):
-    genesis = cGenesis()
-    genesis.Open(cString(genesisFileName))
-    if 0 == genesis.IsOpen():
-      warningNoMethodName("Unable to find file " +  genesisFileName)
+  def doLoadPetriDishConfigFileSlot(self, avida_cfgFileName = None):
+    avida_cfg = cGenesis()
+    avida_cfg.Open(cString(avida_cfgFileName))
+    if 0 == avida_cfg.IsOpen():
+      warningNoMethodName("Unable to find file " +  avida_cfgFileName)
       return
     descr("self.setAvidaSlot(None) ...")
     self.setAvidaSlot(None)
     descr("self.setAvidaSlot(None) done.")
     avida = pyAvida()
-    avida.construct(genesis)
+    avida.construct(avida_cfg)
     descr("self.setAvidaSlot(avida) ...")
     self.setAvidaSlot(avida)
     descr("self.setAvidaSlot(avida) done.")

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py	2008-07-04 08:48:55 UTC (rev 2709)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pySessionCtrl.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -290,7 +290,7 @@
       def test(self):
         class pyMdl: pass
         mdl = pyMdl()
-        session_ctrl_factory = lambda : pySessionCtrl().construct(mdl, cString("genesis.avida"))
+        session_ctrl_factory = lambda : pySessionCtrl().construct(mdl, cString("avida_cfg.avida"))
 
         these_will_live_on = [
           # this is the mdl object created above.

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyTemporaryReloads.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyTemporaryReloads.py	2008-07-04 08:48:55 UTC (rev 2709)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyTemporaryReloads.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -110,7 +110,7 @@
   "AvidaGui2.pyTimeline",
   "AvidaGui2.pyTimelineView",
   "AvidaGui2.pyTimelineCtrl",
-  "AvidaGui2.pyWriteGenesisEvent",
+  "AvidaGui2.pyWriteAvidaCfgEvent",
   "AvidaGui2.pyWriteToFreezer",
   
   "AvidaGui2.pyOneAna_GraphView",

Copied: branches/developers/avida-edward/source/python/AvidaGui2/pyWriteAvidaCfgEvent.py (from rev 2707, branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py)
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyWriteAvidaCfgEvent.py	                        (rev 0)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyWriteAvidaCfgEvent.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -0,0 +1,310 @@
+# -*- coding: utf-8 -*-
+
+import shutil, string, pyInstructionSet, os.path
+
+from AvidaCore import *
+
+from descr import *
+
+# Class to write the working avida_cfg, event and environment files based on 
+# the contents of settings dictionary
+
+class pyWriteAvidaCfgEvent:
+
+  def __init__(self, in_dict = None, session_mdl = None, workspace_dir = None, 
+    freeze_dir = None, tmp_in_dir = None, tmp_out_dir = None):
+    
+    self.m_session_mdl = session_mdl
+
+    # If the file "research.version" exists in the current workspace we
+    # are going to ignore any settings in the petri dish
+
+    if os.path.exists(os.path.join(workspace_dir,"research.version")):
+      settings_dict = {}
+    else:
+      settings_dict = in_dict["SETTINGS"]
+	
+    # Copies default event file and add to the 
+    # temporary dictionary where the input files will live
+
+    shutil.copyfile(os.path.join(workspace_dir, "events.default"), os.path.join(tmp_in_dir, "events.cfg"))
+    
+    # If this is a full petri dish inject all the organisms, otherwise
+    # inject the start creature in the center of the grid
+
+    
+    #if we have a full petri dish...
+    if in_dict.has_key("CELLS") and \
+       (not (os.path.exists(os.path.join(workspace_dir,"research.version")))): 
+      cells_dict = in_dict["CELLS"]
+      organisms_dict = in_dict["ORGANISMS"]
+      self.m_session_mdl.m_founding_cells_dict = cells_dict
+
+      if in_dict.has_key("ANCESTOR_NAMES"):
+        session_mdl.m_ancestors_dict = in_dict["ANCESTOR_NAMES"]
+      else:
+        session_mdl.m_ancestors_dict = {};
+      if in_dict.has_key("ANCESTOR_LINKS"):
+        ancestor_link_dict = in_dict["ANCESTOR_LINKS"]
+      else:
+        ancestor_link_dict = {}
+      self.m_session_mdl.m_founding_cells_dict = cells_dict
+      self.m_session_mdl.m_cell_num_ancestor_name_dict = {}
+
+      for tmp_cell, org_in_cell in cells_dict.iteritems():
+        linage_lable_in_cell = ancestor_link_dict[org_in_cell]
+        ann_name_in_cell = session_mdl.m_ancestors_dict[linage_lable_in_cell]
+        session_mdl.m_cell_num_ancestor_name_dict[tmp_cell] = ann_name_in_cell
+      self.m_session_mdl.m_global_num_of_ancestors = \
+        len(session_mdl.m_cell_num_ancestor_name_dict)
+
+    #if it is not a full petri dish
+    else:
+      self.m_session_mdl.m_cell_num_ancestor_name_dict = {}
+      self.m_session_mdl.m_global_num_of_ancestors = 0
+      self.m_session_mdl.m_founding_cells_dict = {}
+      cells_dict = {}
+      organisms_dict = {}
+      session_mdl.m_ancestors_dict = {}
+      ancestor_link_dict = {}
+      if settings_dict.has_key("START_CREATURE0"):
+        world_x = settings_dict["WORLD-X"]
+        world_y = settings_dict["WORLD-Y"]
+
+        # Count all ancestors with the name of the form START_CREATUREx
+
+        num_ancestors = 0
+        while(settings_dict.has_key("START_CREATURE" + str(num_ancestors))):
+          num_ancestors = num_ancestors + 1
+        self.m_session_mdl.m_global_num_of_ancestors = num_ancestors
+
+        # Process all the ancestors
+
+        for i in range(num_ancestors):
+          start_creature = settings_dict["START_CREATURE" + str(i)]
+          session_mdl.m_ancestors_dict[str(i)] = start_creature
+          ancestor_link_dict[str(i)] = str(i)
+
+          self.start_cell_location = self.find_location(world_x, world_y, 
+             num_ancestors, i)
+          cells_dict[str(self.start_cell_location)] = str(i)
+
+          # This variable is used in pyPetriDishCtrl.py to outline the 
+          # founding organisms
+
+          self.m_session_mdl.m_founding_cells_dict = cells_dict
+          self.m_session_mdl.m_cell_num_ancestor_name_dict[str(self.start_cell_location)] = \
+            session_mdl.m_ancestors_dict[str(i)]
+
+          # Read the genome from the dictionary
+
+          organisms_dict[str(i)] = settings_dict["START_GENOME" + str(i)]
+
+    shutil.copyfile(os.path.join(workspace_dir, "inst_set.default"), \
+                    os.path.join(tmp_in_dir, "inst_set.default"))
+
+    settings_dict["EVENT_FILE"] = os.path.join(tmp_in_dir, "events.cfg")
+    settings_dict["ENVIRONMENT_FILE"] = os.path.join(tmp_in_dir, "environment.cfg")
+    self.writeEnvironmentFile(workspace_dir, settings_dict)
+    settings_dict["INST_SET"] = os.path.join(tmp_in_dir, "inst_set.default")
+    avida_cfg_file_name = self.writeAvidaCfgFile(workspace_dir, tmp_in_dir, \
+                                              settings_dict)
+    
+    # There's a loop around organisms_dict
+    #   organism number is key, sequence is value.
+    #   I need to make a merits_dict with organism number as key, and
+    #   merit as value.
+    avida_cfg = cGenesis()
+
+    cConfig.Setup(avida_cfg)
+
+    avida_cfg.Open(cString(avida_cfg_file_name))
+    environment = cEnvironment()
+    environment.Load(cString(settings_dict["ENVIRONMENT_FILE"]))
+    environment.GetInstSet().SetInstLib(cHardwareCPU.GetInstLib())
+    cHardwareUtil.LoadInstSet(cString(settings_dict["INST_SET"]), environment.GetInstSet())
+    cConfig.SetNumInstructions(environment.GetInstSet().GetSize())
+    cConfig.SetNumTasks(environment.GetTaskLib().GetSize())
+    cConfig.SetNumReactions(environment.GetReactionLib().GetSize())
+    cConfig.SetNumResources(environment.GetResourceLib().GetSize())
+    test_interface = cPopulationInterface()
+    BuildTestPopInterface(test_interface)
+    cTestCPU.Setup(
+      environment.GetInstSet(),
+      environment,
+      environment.GetResourceLib().GetSize(),
+      test_interface)
+
+    inst_set = environment.GetInstSet()
+    merits_dict = {}
+    for key in organisms_dict.keys():
+      genome = organisms_dict[key]
+      analyze_genotype = cAnalyzeGenotype(cString(genome), inst_set) 
+
+      random_number_generator_state = cRandom(cTools.globalRandom())
+      analyze_genotype.Recalculate()
+      cTools.globalRandom().Clone(random_number_generator_state)
+
+      merit = analyze_genotype.GetMerit()
+      merits_dict[key] = merit
+
+    self.modifyEventFile(cells_dict, organisms_dict, ancestor_link_dict,
+      merits_dict, os.path.join(tmp_in_dir, "events.cfg"), tmp_out_dir)
+    
+  # Read the default avida_cfg file, if there is a equivilent line in the 
+  # dictionary replace it the new values, otherwise just copy the line
+
+  def writeAvidaCfgFile(self, workspace_dir, tmp_in_dir, settings_dict):
+  
+    orig_avida_cfg_filename = os.path.join(workspace_dir, "avida_cfg.default")
+    if not os.path.exists(orig_avida_cfg_filename):
+      orig_avida_cfg_filename = os.path.join(workspace_dir, "genesis.default")
+    orig_avida_cfg_file = open(orig_avida_cfg_filename)
+    lines = orig_avida_cfg_file.readlines()
+    orig_avida_cfg_file.close()
+    out_avida_cfg_file = open(os.path.join(tmp_in_dir, "avida_cfg.avida"), "w")
+    for line in lines:
+      comment_start = line.find("#")
+      if comment_start > -1:
+        if comment_start == 0:
+          clean_line = ""
+        else:
+          clean_line = line[:comment_start]
+      else:
+        clean_line = line;
+      clean_line = clean_line.strip()
+      if len(clean_line) > 0:
+        var_name, value = string.split(clean_line)
+        var_name = var_name.upper()
+
+        # BDB -- added second if statment clause to support pause_at hack
+
+        if (settings_dict.has_key(var_name) == True) and \
+           (var_name != "MAX_UPDATES"):
+          out_avida_cfg_file.write(var_name + " " + str(settings_dict[var_name]) + "\n")
+        else:
+          out_avida_cfg_file.write(line)
+      else:
+         out_avida_cfg_file.write(line)
+    out_avida_cfg_file.close()
+    
+    return out_avida_cfg_file.name
+   
+  # Read the default environment file, if there is a reward in the
+  # dictionary for a given resource print out that line in working env. file
+
+  def writeEnvironmentFile(self, workspace_dir, settings_dict):
+ 
+    orig_environment_file = open(os.path.join(workspace_dir, "environment.default"))
+    lines = orig_environment_file.readlines()
+    orig_environment_file.close()
+    out_environment_file = open(settings_dict["ENVIRONMENT_FILE"], "w")
+    for line in lines:
+      comment_start = line.find("#")
+      if comment_start > -1:
+        if comment_start == 0:
+          clean_line = ""
+        else:
+          clean_line = line[:comment_start]
+      else:
+        clean_line = line;
+      clean_line = clean_line.strip()
+      if len(clean_line) > 0:
+        split_out = string.split(clean_line)
+        command_name = split_out[0].upper()
+
+        # if it is a reaction line check further (otherwise print the line)
+
+        if command_name == "REACTION":
+          resource_name = split_out[1].upper()
+          resource_key = "REWARD_" + resource_name
+          task_name = split_out[2]
+
+          # If the there is a reward key for this resource check further
+          # (otherwise print the line)
+ 
+          if settings_dict.has_key(resource_key) == True:
+
+            # If the value of the reward key is true print it out as is 
+            # (otherwise print out as a zero bonus)
+
+            if settings_dict[resource_key] == "YES":
+              out_environment_file.write(line)
+            else:
+              out_environment_file.write("REACTION " + resource_name + " " +
+                                task_name + " process:value=0.0:type=add\n")
+          else:
+            out_environment_file.write(line)
+        else:
+          out_environment_file.write(line)
+
+    out_environment_file.close()
+
+  def modifyEventFile(self, cells_dict, organisms_dict, ancestor_link_dict, merits_dict,
+    event_file_name, tmp_out_dir = None):
+
+    # Routine to add to the event.cfg file by inject creatures into the
+    # population and adding print statements into the correct directory
+
+    event_out_file = open(event_file_name, 'a')
+    for cell in cells_dict.keys():
+      part1 = "u begin inject_sequence " +  organisms_dict[cells_dict[cell]]
+      part2 = " " + cell + " " + str(int(cell)+1)
+      #part3 = " -1 "
+      part3 = " " + str(merits_dict[cells_dict[cell]]) + " "
+      if (ancestor_link_dict.has_key(cells_dict[cell])):
+        part4 = ancestor_link_dict[cells_dict[cell]] + "\n"
+      else:
+        part4 ="\n"
+      event_out_file.write(part1 + part2 + part3 + part4)
+    
+    # write the .dat files to the correct directory
+
+    event_out_file.write("\nu 0:1:end print_average_data " + 
+                         os.path.join(tmp_out_dir, "average.dat") +"\n")
+    event_out_file.write("u 0:1:end print_count_data " + 
+                         os.path.join(tmp_out_dir, "count.dat") +"\n")
+    event_out_file.close()
+    
+  def find_location(self, world_x, world_y, num_ancestors=1, org_num=0):
+
+    # Routine to evenly place a given ancestor into the petri dish
+
+    # If there are more than 9 creatures place them evenly in the population
+    # array (ignoring the edges)
+
+    if (num_ancestors > 9):
+      return int(float(world_x * world_y) * (float(org_num + 1)/float(num_ancestors + 1))) % (world_x * world_y)
+
+    spots = {};
+    if (num_ancestors == 1):
+      spots = [0.5,0.5]
+    elif (num_ancestors == 2):
+      spots = [0.5,0.33, 0.5,0.67]
+    elif (num_ancestors == 3):
+      spots = [0.5,0.25, 0.25,0.75, 0.75,0.75]
+    elif (num_ancestors == 4):
+      spots = [0.33,0.33, 0.33,0.67, 0.67,0.33, 0.67,0.67]
+    elif (num_ancestors == 5):
+      spots = [0.25,0.25, 0.75,0.25, 0.50,0.50, 0.25,0.75, 0.75,0.75]
+    elif (num_ancestors == 6):
+      spots = [0.25,0.25, 0.75,0.25, 
+               0.25,0.50, 0.75,0.50,
+               0.25,0.75, 0.75,0.75]
+    elif (num_ancestors == 7):
+      spots = [0.25,0.25, 0.75,0.25, 
+               0.25,0.50, 0.50,0.50, 0.75,0.50,
+               0.25,0.75, 0.75,0.75]
+    elif (num_ancestors == 8):
+      spots = [0.25,0.25, 0.50,0.375, 0.75,0.25, 
+               0.25,0.50, 0.75,0.50,
+               0.25,0.75, 0.50,0.625, 0.75,0.75]
+    elif (num_ancestors == 9):
+      spots = [0.25,0.25, 0.50,0.25, 0.75,0.25, 
+               0.25,0.50, 0.50,0.50, 0.75,0.50,
+               0.25,0.75, 0.50,0.75, 0.75,0.75]
+
+    x = spots[org_num * 2]
+    y = spots[(org_num * 2) + 1]
+
+    return int((round(world_y * y) * world_x) + round(world_x * x)) % (world_x * world_y)


Property changes on: branches/developers/avida-edward/source/python/AvidaGui2/pyWriteAvidaCfgEvent.py
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py	2008-07-04 08:48:55 UTC (rev 2709)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyWriteGenesisEvent.py	2008-07-04 09:21:22 UTC (rev 2710)
@@ -1,307 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import shutil, string, pyInstructionSet, os.path
-
-from AvidaCore import *
-
-from descr import *
-
-# Class to write the working genesis, event and environment files based on 
-# the contents of settings dictionary
-
-class pyWriteGenesisEvent:
-
-  def __init__(self, in_dict = None, session_mdl = None, workspace_dir = None, 
-    freeze_dir = None, tmp_in_dir = None, tmp_out_dir = None):
-    
-    self.m_session_mdl = session_mdl
-
-    # If the file "research.version" exists in the current workspace we
-    # are going to ignore any settings in the petri dish
-
-    if os.path.exists(os.path.join(workspace_dir,"research.version")):
-      settings_dict = {}
-    else:
-      settings_dict = in_dict["SETTINGS"]
-	
-    # Copies default event file and add to the 
-    # temporary dictionary where the input files will live
-
-    shutil.copyfile(os.path.join(workspace_dir, "events.default"), os.path.join(tmp_in_dir, "events.cfg"))
-    
-    # If this is a full petri dish inject all the organisms, otherwise
-    # inject the start creature in the center of the grid
-
-    
-    #if we have a full petri dish...
-    if in_dict.has_key("CELLS") and \
-       (not (os.path.exists(os.path.join(workspace_dir,"research.version")))): 
-      cells_dict = in_dict["CELLS"]
-      organisms_dict = in_dict["ORGANISMS"]
-      self.m_session_mdl.m_founding_cells_dict = cells_dict
-
-      if in_dict.has_key("ANCESTOR_NAMES"):
-        session_mdl.m_ancestors_dict = in_dict["ANCESTOR_NAMES"]
-      else:
-        session_mdl.m_ancestors_dict = {};
-      if in_dict.has_key("ANCESTOR_LINKS"):
-        ancestor_link_dict = in_dict["ANCESTOR_LINKS"]
-      else:
-        ancestor_link_dict = {}
-      self.m_session_mdl.m_founding_cells_dict = cells_dict
-      self.m_session_mdl.m_cell_num_ancestor_name_dict = {}
-
-      for tmp_cell, org_in_cell in cells_dict.iteritems():
-        linage_lable_in_cell = ancestor_link_dict[org_in_cell]
-        ann_name_in_cell = session_mdl.m_ancestors_dict[linage_lable_in_cell]
-        session_mdl.m_cell_num_ancestor_name_dict[tmp_cell] = ann_name_in_cell
-      self.m_session_mdl.m_global_num_of_ancestors = \
-        len(session_mdl.m_cell_num_ancestor_name_dict)
-
-    #if it is not a full petri dish
-    else:
-      self.m_session_mdl.m_cell_num_ancestor_name_dict = {}
-      self.m_session_mdl.m_global_num_of_ancestors = 0
-      self.m_session_mdl.m_founding_cells_dict = {}
-      cells_dict = {}
-      organisms_dict = {}
-      session_mdl.m_ancestors_dict = {}
-      ancestor_link_dict = {}
-      if settings_dict.has_key("START_CREATURE0"):
-        world_x = settings_dict["WORLD-X"]
-        world_y = settings_dict["WORLD-Y"]
-
-        # Count all ancestors with the name of the form START_CREATUREx
-
-        num_ancestors = 0
-        while(settings_dict.has_key("START_CREATURE" + str(num_ancestors))):
-          num_ancestors = num_ancestors + 1
-        self.m_session_mdl.m_global_num_of_ancestors = num_ancestors
-
-        # Process all the ancestors
-
-        for i in range(num_ancestors):
-          start_creature = settings_dict["START_CREATURE" + str(i)]
-          session_mdl.m_ancestors_dict[str(i)] = start_creature
-          ancestor_link_dict[str(i)] = str(i)
-
-          self.start_cell_location = self.find_location(world_x, world_y, 
-             num_ancestors, i)
-          cells_dict[str(self.start_cell_location)] = str(i)
-
-          # This variable is used in pyPetriDishCtrl.py to outline the 
-          # founding organisms
-
-          self.m_session_mdl.m_founding_cells_dict = cells_dict
-          self.m_session_mdl.m_cell_num_ancestor_name_dict[str(self.start_cell_location)] = \
-            session_mdl.m_ancestors_dict[str(i)]
-
-          # Read the genome from the dictionary
-
-          organisms_dict[str(i)] = settings_dict["START_GENOME" + str(i)]
-
-    shutil.copyfile(os.path.join(workspace_dir, "inst_set.default"), \
-                    os.path.join(tmp_in_dir, "inst_set.default"))
-
-    settings_dict["EVENT_FILE"] = os.path.join(tmp_in_dir, "events.cfg")
-    settings_dict["ENVIRONMENT_FILE"] = os.path.join(tmp_in_dir, "environment.cfg")
-    self.writeEnvironmentFile(workspace_dir, settings_dict)
-    settings_dict["INST_SET"] = os.path.join(tmp_in_dir, "inst_set.default")
-    genesis_file_name = self.writeGenesisFile(workspace_dir, tmp_in_dir, \
-                                              settings_dict)
-    
-    # There's a loop around organisms_dict
-    #   organism number is key, sequence is value.
-    #   I need to make a merits_dict with organism number as key, and
-    #   merit as value.
-    genesis = cGenesis()
-
-    cConfig.Setup(genesis)
-
-    genesis.Open(cString(genesis_file_name))
-    environment = cEnvironment()
-    environment.Load(cString(settings_dict["ENVIRONMENT_FILE"]))
-    environment.GetInstSet().SetInstLib(cHardwareCPU.GetInstLib())
-    cHardwareUtil.LoadInstSet(cString(settings_dict["INST_SET"]), environment.GetInstSet())
-    cConfig.SetNumInstructions(environment.GetInstSet().GetSize())
-    cConfig.SetNumTasks(environment.GetTaskLib().GetSize())
-    cConfig.SetNumReactions(environment.GetReactionLib().GetSize())
-    cConfig.SetNumResources(environment.GetResourceLib().GetSize())
-    test_interface = cPopulationInterface()
-    BuildTestPopInterface(test_interface)
-    cTestCPU.Setup(
-      environment.GetInstSet(),
-      environment,
-      environment.GetResourceLib().GetSize(),
-      test_interface)
-
-    inst_set = environment.GetInstSet()
-    merits_dict = {}
-    for key in organisms_dict.keys():
-      genome = organisms_dict[key]
-      analyze_genotype = cAnalyzeGenotype(cString(genome), inst_set) 
-
-      random_number_generator_state = cRandom(cTools.globalRandom())
-      analyze_genotype.Recalculate()
-      cTools.globalRandom().Clone(random_number_generator_state)
-
-      merit = analyze_genotype.GetMerit()
-      merits_dict[key] = merit
-
-    self.modifyEventFile(cells_dict, organisms_dict, ancestor_link_dict,
-      merits_dict, os.path.join(tmp_in_dir, "events.cfg"), tmp_out_dir)
-    
-  # Read the default genesis file, if there is a equivilent line in the 
-  # dictionary replace it the new values, otherwise just copy the line
-
-  def writeGenesisFile(self, workspace_dir, tmp_in_dir, settings_dict):
-  
-    orig_genesis_file = open(os.path.join(workspace_dir, "genesis.default"))
-    lines = orig_genesis_file.readlines()
-    orig_genesis_file.close()
-    out_genesis_file = open(os.path.join(tmp_in_dir, "genesis.avida"), "w")
-    for line in lines:
-      comment_start = line.find("#")
-      if comment_start > -1:
-        if comment_start == 0:
-          clean_line = ""
-        else:
-          clean_line = line[:comment_start]
-      else:
-        clean_line = line;
-      clean_line = clean_line.strip()
-      if len(clean_line) > 0:
-        var_name, value = string.split(clean_line)
-        var_name = var_name.upper()
-
-        # BDB -- added second if statment clause to support pause_at hack
-
-        if (settings_dict.has_key(var_name) == True) and \
-           (var_name != "MAX_UPDATES"):
-          out_genesis_file.write(var_name + " " + str(settings_dict[var_name]) + "\n")
-        else:
-          out_genesis_file.write(line)
-      else:
-         out_genesis_file.write(line)
-    out_genesis_file.close()
-    
-    return out_genesis_file.name
-   
-  # Read the default environment file, if there is a reward in the
-  # dictionary for a given resource print out that line in working env. file
-
-  def writeEnvironmentFile(self, workspace_dir, settings_dict):
- 
-    orig_environment_file = open(os.path.join(workspace_dir, "environment.default"))
-    lines = orig_environment_file.readlines()
-    orig_environment_file.close()
-    out_environment_file = open(settings_dict["ENVIRONMENT_FILE"], "w")
-    for line in lines:
-      comment_start = line.find("#")
-      if comment_start > -1:
-        if comment_start == 0:
-          clean_line = ""
-        else:
-          clean_line = line[:comment_start]
-      else:
-        clean_line = line;
-      clean_line = clean_line.strip()
-      if len(clean_line) > 0:
-        split_out = string.split(clean_line)
-        command_name = split_out[0].upper()
-
-        # if it is a reaction line check further (otherwise print the line)
-
-        if command_name == "REACTION":
-          resource_name = split_out[1].upper()
-          resource_key = "REWARD_" + resource_name
-          task_name = split_out[2]
-
-          # If the there is a reward key for this resource check further
-          # (otherwise print the line)
- 
-          if settings_dict.has_key(resource_key) == True:
-
-            # If the value of the reward key is true print it out as is 
-            # (otherwise print out as a zero bonus)
-
-            if settings_dict[resource_key] == "YES":
-              out_environment_file.write(line)
-            else:
-              out_environment_file.write("REACTION " + resource_name + " " +
-                                task_name + " process:value=0.0:type=add\n")
-          else:
-            out_environment_file.write(line)
-        else:
-          out_environment_file.write(line)
-
-    out_environment_file.close()
-
-  def modifyEventFile(self, cells_dict, organisms_dict, ancestor_link_dict, merits_dict,
-    event_file_name, tmp_out_dir = None):
-
-    # Routine to add to the event.cfg file by inject creatures into the
-    # population and adding print statements into the correct directory
-
-    event_out_file = open(event_file_name, 'a')
-    for cell in cells_dict.keys():
-      part1 = "u begin inject_sequence " +  organisms_dict[cells_dict[cell]]
-      part2 = " " + cell + " " + str(int(cell)+1)
-      #part3 = " -1 "
-      part3 = " " + str(merits_dict[cells_dict[cell]]) + " "
-      if (ancestor_link_dict.has_key(cells_dict[cell])):
-        part4 = ancestor_link_dict[cells_dict[cell]] + "\n"
-      else:
-        part4 ="\n"
-      event_out_file.write(part1 + part2 + part3 + part4)
-    
-    # write the .dat files to the correct directory
-
-    event_out_file.write("\nu 0:1:end print_average_data " + 
-                         os.path.join(tmp_out_dir, "average.dat") +"\n")
-    event_out_file.write("u 0:1:end print_count_data " + 
-                         os.path.join(tmp_out_dir, "count.dat") +"\n")
-    event_out_file.close()
-    
-  def find_location(self, world_x, world_y, num_ancestors=1, org_num=0):
-
-    # Routine to evenly place a given ancestor into the petri dish
-
-    # If there are more than 9 creatures place them evenly in the population
-    # array (ignoring the edges)
-
-    if (num_ancestors > 9):
-      return int(float(world_x * world_y) * (float(org_num + 1)/float(num_ancestors + 1))) % (world_x * world_y)
-
-    spots = {};
-    if (num_ancestors == 1):
-      spots = [0.5,0.5]
-    elif (num_ancestors == 2):
-      spots = [0.5,0.33, 0.5,0.67]
-    elif (num_ancestors == 3):
-      spots = [0.5,0.25, 0.25,0.75, 0.75,0.75]
-    elif (num_ancestors == 4):
-      spots = [0.33,0.33, 0.33,0.67, 0.67,0.33, 0.67,0.67]
-    elif (num_ancestors == 5):
-      spots = [0.25,0.25, 0.75,0.25, 0.50,0.50, 0.25,0.75, 0.75,0.75]
-    elif (num_ancestors == 6):
-      spots = [0.25,0.25, 0.75,0.25, 
-               0.25,0.50, 0.75,0.50,
-               0.25,0.75, 0.75,0.75]
-    elif (num_ancestors == 7):
-      spots = [0.25,0.25, 0.75,0.25, 
-               0.25,0.50, 0.50,0.50, 0.75,0.50,
-               0.25,0.75, 0.75,0.75]
-    elif (num_ancestors == 8):
-      spots = [0.25,0.25, 0.50,0.375, 0.75,0.25, 
-               0.25,0.50, 0.75,0.50,
-               0.25,0.75, 0.50,0.625, 0.75,0.75]
-    elif (num_ancestors == 9):
-      spots = [0.25,0.25, 0.50,0.25, 0.75,0.25, 
-               0.25,0.50, 0.50,0.50, 0.75,0.50,
-               0.25,0.75, 0.50,0.75, 0.75,0.75]
-
-    x = spots[org_num * 2]
-    y = spots[(org_num * 2) + 1]
-
-    return int((round(world_y * y) * world_x) + round(world_x * x)) % (world_x * world_y)




More information about the Avida-cvs mailing list