[Avida-SVN] r3031 - development/source/cpu
brysonda at myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Sat Dec 13 12:30:00 PST 2008
Author: brysonda
Date: 2008-12-13 15:30:00 -0500 (Sat, 13 Dec 2008)
New Revision: 3031
Modified:
development/source/cpu/cHardwareCPU.cc
development/source/cpu/cHardwareExperimental.cc
development/source/cpu/cHardwareExperimental.h
Log:
Implement all on copy mutation types in cHardwareExperimental.
Remove extraneous if block in cHardwareCPU::Inst_HeadCopy.
Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc 2008-12-12 22:25:32 UTC (rev 3030)
+++ development/source/cpu/cHardwareCPU.cc 2008-12-13 20:30:00 UTC (rev 3031)
@@ -523,9 +523,7 @@
: cHardwareBase(world, in_organism, in_m_inst_set)
, m_last_cell_data(false, 0)
{
- /* FIXME: reorganize storage of m_functions. -- kgn */
m_functions = s_inst_slib->GetFunctions();
- /**/
m_spec_die = false;
m_epigenetic_state = false;
@@ -5049,12 +5047,6 @@
read_head.Advance();
write_head.Advance();
-
- //Slip mutations
- if (m_organism->TestCopySlip(ctx)) {
-
- }
-
return true;
}
Modified: development/source/cpu/cHardwareExperimental.cc
===================================================================
--- development/source/cpu/cHardwareExperimental.cc 2008-12-12 22:25:32 UTC (rev 3030)
+++ development/source/cpu/cHardwareExperimental.cc 2008-12-13 20:30:00 UTC (rev 3031)
@@ -206,9 +206,7 @@
cHardwareExperimental::cHardwareExperimental(cAvidaContext& ctx, cWorld* world, cOrganism* in_organism, cInstSet* in_m_inst_set)
: cHardwareBase(world, in_organism, in_m_inst_set)
{
- /* FIXME: reorganize storage of m_functions. -- kgn */
m_functions = s_inst_slib->GetFunctions();
- /**/
m_spec_die = false;
@@ -218,6 +216,8 @@
m_promoters_enabled = m_world->GetConfig().PROMOTERS_ENABLED.Get();
m_constituative_regulation = m_world->GetConfig().CONSTITUTIVE_REGULATION.Get();
+ m_slip_read_head = !m_world->GetConfig().SLIP_COPY_MODE.Get();
+
m_memory = in_organism->GetGenome(); // Initialize memory...
Reset(ctx); // Setup the rest of the hardware...
}
@@ -1368,6 +1368,9 @@
setInternalValue(m_threads[m_cur_thread].reg[dst], read_inst);
ReadInst(read_inst);
+ if (m_slip_read_head && m_organism->TestCopySlip(ctx))
+ GetHead(head_id).Set(ctx.GetRandom().GetInt(GetHead(head_id).GetMemory().GetSize()));
+
GetHead(head_id).Advance();
return true;
}
@@ -1386,6 +1389,12 @@
active_head.SetInst(cInstruction(value));
active_head.SetFlagCopied();
+ if (m_organism->TestCopyIns(ctx)) active_head.InsertInst(m_inst_set->GetRandomInst(ctx));
+ if (m_organism->TestCopyDel(ctx)) active_head.RemoveInst();
+ if (m_organism->TestCopyUniform(ctx)) doUniformCopyMutation(ctx, active_head);
+ if (!m_slip_read_head && m_organism->TestCopySlip(ctx))
+ doSlipMutation(ctx, active_head.GetMemory(), active_head.GetPosition());
+
// Advance the head after write...
active_head++;
return true;
@@ -1412,6 +1421,16 @@
write_head.SetInst(read_inst);
write_head.SetFlagCopied(); // Set the copied flag...
+ if (m_organism->TestCopyIns(ctx)) write_head.InsertInst(m_inst_set->GetRandomInst(ctx));
+ if (m_organism->TestCopyDel(ctx)) write_head.RemoveInst();
+ if (m_organism->TestCopyUniform(ctx)) doUniformCopyMutation(ctx, write_head);
+ if (m_organism->TestCopySlip(ctx)) {
+ if (m_slip_read_head) {
+ read_head.Set(ctx.GetRandom().GetInt(read_head.GetMemory().GetSize()));
+ } else
+ doSlipMutation(ctx, write_head.GetMemory(), write_head.GetPosition());
+ }
+
read_head.Advance();
write_head.Advance();
return true;
Modified: development/source/cpu/cHardwareExperimental.h
===================================================================
--- development/source/cpu/cHardwareExperimental.h 2008-12-12 22:25:32 UTC (rev 3030)
+++ development/source/cpu/cHardwareExperimental.h 2008-12-13 20:30:00 UTC (rev 3031)
@@ -56,6 +56,9 @@
#ifndef tArray_h
#include "tArray.h"
#endif
+#ifndef tManagedPointerArray_h
+#include "tManagedPointerArray.h"
+#endif
#ifndef tInstLib_h
#include "tInstLib.h"
#endif
@@ -195,6 +198,8 @@
bool m_promoters_enabled:1;
bool m_constituative_regulation:1;
+ bool m_slip_read_head:1;
+
bool m_io_expire:1;
};
@@ -215,7 +220,7 @@
inline int GetRegulatedBitCode() { return m_bit_code ^ m_regulation; }
inline ~cPromoter() { ; }
};
- tArray<cPromoter> m_promoters;
+ tManagedPointerArray<cPromoter> m_promoters;
// Promoter Model -->
More information about the Avida-cvs
mailing list