[Avida-cvs] [avida-svn] r946 - in development/source: cpu main
brysonda at myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Tue Sep 12 17:10:04 PDT 2006
Author: brysonda
Date: 2006-09-12 20:10:03 -0400 (Tue, 12 Sep 2006)
New Revision: 946
Modified:
development/source/cpu/cHardwareCPU.cc
development/source/main/cBirthChamber.cc
development/source/main/cEnvironment.cc
development/source/main/cReactionResult.cc
development/source/main/cReactionResult.h
Log:
Some code cleanup.
Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc 2006-09-12 03:17:18 UTC (rev 945)
+++ development/source/cpu/cHardwareCPU.cc 2006-09-13 00:10:03 UTC (rev 946)
@@ -1499,79 +1499,6 @@
return false;
}
-// @DMB - this will not function (as intended) without cross-hardware head support
-//
-//bool cHardwareCPU::Inst_JumpP(cAvidaContext& ctx)
-//{
-// cOrganism * other_organism = organism->GetNeighbor();
-//
-// // Make sure the other organism was found and that its hardware is of the
-// // same type, or else we won't be able to be parasitic on it.
-// if (other_organism == NULL ||
-// other_organism->GetHardware().GetType() != GetType()) {
-// // Without another organism, its hard to determine if we're dealing
-// // with a parasite. For the moment, we'll assume it is and move on.
-// // @CAO Do better!
-// organism->GetPhenotype().IsParasite() = true;
-// return true;
-// }
-//
-// // Otherwise, grab the hardware from the neighbor, and use it!
-// cHardwareCPU & other_hardware = (cHardwareCPU &) other_organism->GetHardware();
-//
-// ReadLabel();
-// GetLabel().Rotate(1, NUM_NOPS);
-//
-// // If there is no label, jump to line BX in creature.
-// if (GetLabel().GetSize() == 0) {
-// const int new_pos = GetRegister(REG_BX);
-// IP().Set(new_pos);
-// organism->GetPhenotype().IsParasite() = true;
-// return true;
-// }
-//
-// // otherwise jump to the complement label.
-// const cHeadCPU jump_location(other_hardware.FindFullLabel(GetLabel()));
-// if (jump_location.GetPosition() != -1) {
-// IP().Set(jump_location);
-// organism->GetPhenotype().IsParasite() = true;
-// return true;
-// }
-//
-// // If complement label was not found; record a warning (since the
-// // actual neighbors are not under the organisms control, this is not
-// // a full-scale error).
-// organism->Fault(FAULT_LOC_JUMP, FAULT_TYPE_WARNING,
-// "jump-p: No complement label");
-// return false;
-//}
-
-// @DMB - this is unnecessary without Inst_JumpP
-//
-//bool cHardwareCPU::Inst_JumpSelf(cAvidaContext& ctx)
-//{
-// ReadLabel();
-// GetLabel().Rotate(1, NUM_NOPS);
-//
-// // If there is no label, jump to line BX in creature.
-// if (GetLabel().GetSize() == 0) {
-// IP().Set(GetRegister(REG_BX));
-// return true;
-// }
-//
-// // otherwise jump to the complement label.
-// const cHeadCPU jump_location( FindFullLabel(GetLabel()) );
-// if ( jump_location.GetPosition() != -1 ) {
-// IP().Set(jump_location);
-// return true;
-// }
-//
-// // If complement label was not found; record an error.
-// organism->Fault(FAULT_LOC_JUMP, FAULT_TYPE_ERROR,
-// "jump-slf: no complement label");
-// return false;
-//}
-
bool cHardwareCPU::Inst_Call(cAvidaContext& ctx)
{
// Put the starting location onto the stack
Modified: development/source/main/cBirthChamber.cc
===================================================================
--- development/source/main/cBirthChamber.cc 2006-09-12 03:17:18 UTC (rev 945)
+++ development/source/main/cBirthChamber.cc 2006-09-13 00:10:03 UTC (rev 946)
@@ -189,7 +189,6 @@
// If this is a new largest genome, increase the array size.
if (size_wait_entry.GetSize() <= child_length) {
- // @DMB unused? -- int old_wait_size = size_wait_entry.GetSize();
size_wait_entry.Resize(child_length + 1);
}
@@ -214,7 +213,6 @@
// If this is a new largest ID, increase the array size.
if (mate_select_wait_entry.GetSize() <= mate_id) {
- // @DMB unused? -- int old_wait_size = mate_select_wait_entry.GetSize();
mate_select_wait_entry.Resize(mate_id + 1);
}
Modified: development/source/main/cEnvironment.cc
===================================================================
--- development/source/main/cEnvironment.cc 2006-09-12 03:17:18 UTC (rev 945)
+++ development/source/main/cEnvironment.cc 2006-09-13 00:10:03 UTC (rev 946)
@@ -679,38 +679,8 @@
// Mark this reaction as occuring...
result.MarkReaction(cur_reaction->GetID());
- }
-
-// @DMB - The following block of code only seems to affect MarkReceiveTask, the side effect of which
-// is not used anywhere.
-//
-// // Loop again to check receive tasks...
-// // if (receive_buf.GetSize() != 0)
-// {
-// // Do setup for reaction tests...
-//
-// for (int i = 0; i < num_reactions; i++) {
-// cReaction* cur_reaction = reaction_lib.GetReaction(i);
-// assert(cur_reaction != NULL);
-//
-// // Only use active reactions...
-// if (cur_reaction->GetActive() == false) continue;
-//
-// // Examine the task trigger associated with this reaction
-// cTaskEntry * cur_task = cur_reaction->GetTask();
-// assert(cur_task != NULL);
-// const double task_quality = m_tasklib.TestOutput(*cur_task, &taskctx);
-// const int task_id = cur_task->GetID();
-//
-// // If this task wasn't performed, move on to the next one.
-// if (task_quality == 0.0) continue;
-//
-// // Mark this task as performed...
-// result.MarkReceiveTask(task_id);
-// }
-// }
+ }
-
return result.GetActive();
}
@@ -781,12 +751,11 @@
double consumed = 0.0;
cResource* in_resource = cur_process->GetResource();
- // Test if infinite resource
if (in_resource == NULL) {
+ // Test if infinite resource
consumed = max_consumed * task_quality;
- }
- // Otherwise we're using a finite resource
- else {
+ } else {
+ // Otherwise we're using a finite resource
const int res_id = in_resource->GetID();
consumed = resource_count[res_id] - result.GetConsumed(res_id);
Modified: development/source/main/cReactionResult.cc
===================================================================
--- development/source/main/cReactionResult.cc 2006-09-12 03:17:18 UTC (rev 945)
+++ development/source/main/cReactionResult.cc 2006-09-13 00:10:03 UTC (rev 946)
@@ -19,8 +19,6 @@
, resources_detected(num_resources)
, tasks_done(num_tasks)
, tasks_quality(num_tasks)
-// @DMB - not used - , receive_tasks_done(num_tasks)
-// @DMB - not used - , send_tasks_done(num_tasks)
, reactions_triggered(num_reactions)
, bonus_add(0.0)
, bonus_mult(1.0)
@@ -41,8 +39,6 @@
resources_detected.SetAll(-1.0);
tasks_done.SetAll(false);
tasks_quality.SetAll(0.0);
-// @DMB - not used - receive_tasks_done.SetAll(false);
-// @DMB - not used - send_tasks_done.SetAll(false);
reactions_triggered.SetAll(false);
// And finally note that this is indeed already active.
@@ -84,19 +80,6 @@
}
-// @DMB - not used - void cReactionResult::MarkReceiveTask(int id)
-// @DMB - not used - {
-// @DMB - not used - ActivateReaction();
-// @DMB - not used - receive_tasks_done[id] = true;
-// @DMB - not used - }
-
-// @DMB - not used - void cReactionResult::MarkSendTask(int id)
-// @DMB - not used - {
-// @DMB - not used - ActivateReaction();
-// @DMB - not used - send_tasks_done[id] = true;
-// @DMB - not used - }
-
-
void cReactionResult::MarkReaction(int id)
{
ActivateReaction();
Modified: development/source/main/cReactionResult.h
===================================================================
--- development/source/main/cReactionResult.h 2006-09-12 03:17:18 UTC (rev 945)
+++ development/source/main/cReactionResult.h 2006-09-13 00:10:03 UTC (rev 946)
@@ -22,8 +22,6 @@
tArray<double> resources_detected; //Initialize to -1.0
tArray<bool> tasks_done;
tArray<double> tasks_quality;
-// @DMB - not used - tArray<bool> receive_tasks_done;
-// @DMB - not used - tArray<bool> send_tasks_done;
tArray<bool> reactions_triggered;
double bonus_add;
double bonus_mult;
@@ -50,8 +48,6 @@
void Lethal(bool flag);
void MarkTask(int id, const double quality=1);
-// @DMB - not used - void MarkReceiveTask(int id);
-// @DMB - not used - void MarkSendTask(int id);
void MarkReaction(int id);
void AddBonus(double value);
void MultBonus(double value);
More information about the Avida-cvs
mailing list