[Avida-SVN] r1339 - in branches/dkdev: Avida.xcodeproj source/cpu source/main
dknoester at myxo.css.msu.edu
dknoester at myxo.css.msu.edu
Mon Feb 19 19:48:21 PST 2007
Author: dknoester
Date: 2007-02-19 22:48:20 -0500 (Mon, 19 Feb 2007)
New Revision: 1339
Removed:
branches/dkdev/source/main/cOrgMessage.cc
branches/dkdev/source/main/cOrgMessage.h
Modified:
branches/dkdev/Avida.xcodeproj/project.pbxproj
branches/dkdev/source/cpu/cHardwareCPU.cc
branches/dkdev/source/cpu/cHardwareSMT.cc
branches/dkdev/source/cpu/cHardwareTransSMT.cc
branches/dkdev/source/cpu/cTestCPUInterface.cc
branches/dkdev/source/cpu/cTestCPUInterface.h
branches/dkdev/source/main/CMakeLists.txt
branches/dkdev/source/main/SConscript
branches/dkdev/source/main/cOrgInterface.h
branches/dkdev/source/main/cOrganism.cc
branches/dkdev/source/main/cOrganism.h
branches/dkdev/source/main/cPopulation.cc
branches/dkdev/source/main/cPopulationInterface.cc
branches/dkdev/source/main/cPopulationInterface.h
Log:
Merge: r1123:1124 from avida/development; removes messaging from cOrganism.
Modified: branches/dkdev/Avida.xcodeproj/project.pbxproj
===================================================================
--- branches/dkdev/Avida.xcodeproj/project.pbxproj 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/Avida.xcodeproj/project.pbxproj 2007-02-20 03:48:20 UTC (rev 1339)
@@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
7005A70609BA0FA90007E16E /* cTestCPUInterface.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7005A70209BA0FA90007E16E /* cTestCPUInterface.cc */; };
7005A70809BA0FA90007E16E /* cTestCPUInterface.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7005A70209BA0FA90007E16E /* cTestCPUInterface.cc */; };
- 7005A83209BA621F0007E16E /* cOrgMessage.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0868808F49EA800FC65FE /* cOrgMessage.cc */; };
700E2996085A1F6000CF158A /* avida in CopyFiles */ = {isa = PBXBuildFile; fileRef = DCC3164D07626CF3008F7A48 /* avida */; };
700E2AF8085DE50C00CF158A /* avida.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3109C0762539E008F7A48 /* avida.cc */; };
700E2B87085DE54400CF158A /* avida-viewer in CopyFiles */ = {isa = PBXBuildFile; fileRef = 700E2B83085DE50C00CF158A /* avida-viewer */; };
@@ -101,7 +100,6 @@
70B0868D08F49EA800FC65FE /* cPopulation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0868908F49EA800FC65FE /* cPopulation.cc */; };
70B0868E08F49EA800FC65FE /* cPopulationCell.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0868A08F49EA800FC65FE /* cPopulationCell.cc */; };
70B0868F08F49EA800FC65FE /* cOrganism.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0868708F49EA800FC65FE /* cOrganism.cc */; };
- 70B0869008F49EA800FC65FE /* cOrgMessage.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0868808F49EA800FC65FE /* cOrgMessage.cc */; };
70B0869108F49EA800FC65FE /* cPopulation.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0868908F49EA800FC65FE /* cPopulation.cc */; };
70B0869208F49EA800FC65FE /* cPopulationCell.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0868A08F49EA800FC65FE /* cPopulationCell.cc */; };
70B0869D08F49F4800FC65FE /* cPhenotype.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0869C08F49F4800FC65FE /* cPhenotype.cc */; };
@@ -500,11 +498,9 @@
70B0865808F4974300FC65FE /* cMxCodeArray.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cMxCodeArray.cc; sourceTree = "<group>"; };
70B0867208F499C100FC65FE /* nMutation.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = nMutation.h; sourceTree = "<group>"; };
70B0868308F49E9700FC65FE /* cOrganism.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cOrganism.h; sourceTree = "<group>"; };
- 70B0868408F49E9700FC65FE /* cOrgMessage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cOrgMessage.h; sourceTree = "<group>"; };
70B0868508F49E9700FC65FE /* cPopulation.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cPopulation.h; sourceTree = "<group>"; };
70B0868608F49E9700FC65FE /* cPopulationCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cPopulationCell.h; sourceTree = "<group>"; };
70B0868708F49EA800FC65FE /* cOrganism.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cOrganism.cc; sourceTree = "<group>"; };
- 70B0868808F49EA800FC65FE /* cOrgMessage.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cOrgMessage.cc; sourceTree = "<group>"; };
70B0868908F49EA800FC65FE /* cPopulation.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cPopulation.cc; sourceTree = "<group>"; };
70B0868A08F49EA800FC65FE /* cPopulationCell.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cPopulationCell.cc; sourceTree = "<group>"; };
70B0869B08F49F3900FC65FE /* cPhenotype.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cPhenotype.h; sourceTree = "<group>"; };
@@ -1287,8 +1283,6 @@
70B0864F08F4972600FC65FE /* cMxCodeArray.h */,
70B0868708F49EA800FC65FE /* cOrganism.cc */,
70B0868308F49E9700FC65FE /* cOrganism.h */,
- 70B0868808F49EA800FC65FE /* cOrgMessage.cc */,
- 70B0868408F49E9700FC65FE /* cOrgMessage.h */,
70B0869C08F49F4800FC65FE /* cPhenotype.cc */,
70B0869B08F49F3900FC65FE /* cPhenotype.h */,
70B0868908F49EA800FC65FE /* cPopulation.cc */,
@@ -1691,7 +1685,6 @@
70B0866708F4974300FC65FE /* cMutationRates.cc in Sources */,
70B0866808F4974300FC65FE /* cMxCodeArray.cc in Sources */,
70B0868F08F49EA800FC65FE /* cOrganism.cc in Sources */,
- 70B0869008F49EA800FC65FE /* cOrgMessage.cc in Sources */,
70B0869108F49EA800FC65FE /* cPopulation.cc in Sources */,
70B0869208F49EA800FC65FE /* cPopulationCell.cc in Sources */,
70B0869E08F49F4800FC65FE /* cPhenotype.cc in Sources */,
@@ -1890,7 +1883,6 @@
7054A17509A8014600038658 /* cAnalyzeJobQueue.cc in Sources */,
7054A1BA09A810CB00038658 /* cAnalyzeJobWorker.cc in Sources */,
7005A70809BA0FA90007E16E /* cTestCPUInterface.cc in Sources */,
- 7005A83209BA621F0007E16E /* cOrgMessage.cc in Sources */,
707AF0B209EAC7FD001AEA89 /* LandscapeActions.cc in Sources */,
705ACD4F0A13FED5002D5BA0 /* PrintActions.cc in Sources */,
708051B20A1F663100CBB8B6 /* SaveLoadActions.cc in Sources */,
@@ -1953,6 +1945,7 @@
suppress,
);
PRODUCT_NAME = avida;
+ USER_HEADER_SEARCH_PATHS = source/main;
};
name = Development;
};
@@ -1965,6 +1958,7 @@
suppress,
);
PRODUCT_NAME = avida;
+ USER_HEADER_SEARCH_PATHS = source/main;
};
name = "Deployment-G4";
};
@@ -2084,6 +2078,7 @@
suppress,
);
PRODUCT_NAME = avida;
+ USER_HEADER_SEARCH_PATHS = source/main;
};
name = "Deployment-G5";
};
@@ -2096,6 +2091,7 @@
suppress,
);
PRODUCT_NAME = avida;
+ USER_HEADER_SEARCH_PATHS = source/main;
};
name = Profile;
};
@@ -2209,6 +2205,7 @@
suppress,
);
PRODUCT_NAME = avida;
+ USER_HEADER_SEARCH_PATHS = source/main;
};
name = "Deployment-Universal";
};
Modified: branches/dkdev/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/dkdev/source/cpu/cHardwareCPU.cc 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/cpu/cHardwareCPU.cc 2007-02-20 03:48:20 UTC (rev 1339)
@@ -591,7 +591,7 @@
void cHardwareCPU::ProcessBonusInst(cAvidaContext& ctx, const cInstruction& inst)
{
// Mark this organism as running...
- bool prev_run_state = organism->GetIsRunning();
+ bool prev_run_state = organism->IsRunning();
organism->SetRunning(true);
if (m_tracer != NULL) m_tracer->TraceHardware(*this, true);
Modified: branches/dkdev/source/cpu/cHardwareSMT.cc
===================================================================
--- branches/dkdev/source/cpu/cHardwareSMT.cc 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/cpu/cHardwareSMT.cc 2007-02-20 03:48:20 UTC (rev 1339)
@@ -319,7 +319,7 @@
void cHardwareSMT::ProcessBonusInst(cAvidaContext& ctx, const cInstruction& inst)
{
// Mark this organism as running...
- bool prev_run_state = organism->GetIsRunning();
+ bool prev_run_state = organism->IsRunning();
organism->SetRunning(true);
// Print the status of this CPU at each step...
Modified: branches/dkdev/source/cpu/cHardwareTransSMT.cc
===================================================================
--- branches/dkdev/source/cpu/cHardwareTransSMT.cc 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/cpu/cHardwareTransSMT.cc 2007-02-20 03:48:20 UTC (rev 1339)
@@ -316,7 +316,7 @@
void cHardwareTransSMT::ProcessBonusInst(cAvidaContext& ctx, const cInstruction& inst)
{
// Mark this organism as running...
- bool prev_run_state = organism->GetIsRunning();
+ bool prev_run_state = organism->IsRunning();
organism->SetRunning(true);
// Print the status of this CPU at each step...
Modified: branches/dkdev/source/cpu/cTestCPUInterface.cc
===================================================================
--- branches/dkdev/source/cpu/cTestCPUInterface.cc 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/cpu/cTestCPUInterface.cc 2007-02-20 03:48:20 UTC (rev 1339)
@@ -11,7 +11,6 @@
#include "cGenotype.h"
#include "cOrganism.h"
-#include "cOrgMessage.h"
#include "cTestCPU.h"
@@ -75,11 +74,6 @@
{
}
-bool cTestCPUInterface::SendMessage(cOrgMessage& mess)
-{
- return false;
-}
-
int cTestCPUInterface::ReceiveValue()
{
return m_testcpu->GetReceiveValue();
Modified: branches/dkdev/source/cpu/cTestCPUInterface.h
===================================================================
--- branches/dkdev/source/cpu/cTestCPUInterface.h 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/cpu/cTestCPUInterface.h 2007-02-20 03:48:20 UTC (rev 1339)
@@ -45,7 +45,6 @@
void Die();
void Kaboom(int distance);
void SpawnDeme();
- bool SendMessage(cOrgMessage& mess);
cOrgSinkMessage* NetReceive() { return NULL; } // @DMB - todo: receive message
bool NetRemoteValidate(cAvidaContext& ctx, cOrgSinkMessage* msg) { return false; } // @DMB - todo: validate message
int ReceiveValue();
Modified: branches/dkdev/source/main/CMakeLists.txt
===================================================================
--- branches/dkdev/source/main/CMakeLists.txt 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/main/CMakeLists.txt 2007-02-20 03:48:20 UTC (rev 1339)
@@ -18,7 +18,6 @@
cMutationLib.cc
cMutationRates.cc
cMxCodeArray.cc
- cOrgMessage.cc
cOrganism.cc
cPhenotype.cc
cPopulation.cc
Modified: branches/dkdev/source/main/SConscript
===================================================================
--- branches/dkdev/source/main/SConscript 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/main/SConscript 2007-02-20 03:48:20 UTC (rev 1339)
@@ -26,7 +26,6 @@
'cMxCodeArray.h',
'cOrganism.h',
'cOrgInterface.h',
- 'cOrgMessage.h',
'cOrgSeqMessage.h',
'cOrgSinkMessage.h',
'cOrgSourceMessage.h',
@@ -73,7 +72,6 @@
'cMutationLib.cc',
'cMutationRates.cc',
'cMxCodeArray.cc',
- 'cOrgMessage.cc',
'cOrganism.cc',
'cPhenotype.cc',
'cPopulation.cc',
Modified: branches/dkdev/source/main/cOrgInterface.h
===================================================================
--- branches/dkdev/source/main/cOrgInterface.h 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/main/cOrgInterface.h 2007-02-20 03:48:20 UTC (rev 1339)
@@ -23,7 +23,6 @@
class cCodeLabel;
class cGenome;
class cOrganism;
-class cOrgMessage;
class cOrgSinkMessage;
template <class T> class tArray;
@@ -54,7 +53,6 @@
virtual void Die() = 0;
virtual void Kaboom(int distance) = 0;
virtual void SpawnDeme() = 0;
- virtual bool SendMessage(cOrgMessage& mess) = 0;
virtual cOrgSinkMessage* NetReceive() = 0;
virtual bool NetRemoteValidate(cAvidaContext& ctx, cOrgSinkMessage* msg) = 0;
virtual int ReceiveValue() = 0;
Deleted: branches/dkdev/source/main/cOrgMessage.cc
===================================================================
--- branches/dkdev/source/main/cOrgMessage.cc 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/main/cOrgMessage.cc 2007-02-20 03:48:20 UTC (rev 1339)
@@ -1,37 +0,0 @@
-/*
- * cOrgMessage.cc
- * Avida
- *
- * Called "org_message.cc" prior to 12/5/05.
- * Copyright 2005-2006 Michigan State University. All rights reserved.
- * Copyright 1993-2003 California Institute of Technology.
- *
- */
-
-#include "cOrgMessage.h"
-
-#include <sstream>
-
-void cOrgMessage::SetData(int in_data)
-{
- std::stringstream ss;
- ss << in_data;
- ss >> data;
-}
-
-void cOrgMessage::SetData(double in_data)
-{
- std::stringstream ss;
- ss << in_data;
- ss >> data;
-}
-
-void cOrgMessage::GetData(int & in_data)
-{
- in_data=atoi(data.c_str());
-}
-
-void cOrgMessage::GetData(double & in_data)
-{
- in_data=atof(data.c_str());
-}
Deleted: branches/dkdev/source/main/cOrgMessage.h
===================================================================
--- branches/dkdev/source/main/cOrgMessage.h 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/main/cOrgMessage.h 2007-02-20 03:48:20 UTC (rev 1339)
@@ -1,55 +0,0 @@
-/*
- * cOrgMessage.h
- * Avida
- *
- * Called "org_message.hh" prior to 12/5/05.
- * Copyright 2005-2006 Michigan State University. All rights reserved.
- * Copyright 1993-2003 California Institute of Technology.
- *
- */
-
-#ifndef cOrgMessage_h
-#define cOrgMessage_h
-
-#include <string>
-
-class cOrgMessage
-{
-private:
- int time;
- int sender_id;
- int recipient_id;
- std::string label;
- std::string data;
-
-public:
- cOrgMessage() : time(-1), sender_id(-1), recipient_id(-1), label(""), data("") { ; }
- cOrgMessage(std::string in_label, std::string in_data) { label = in_label; data = in_data; }
-
- void SetTime(int in_time) { time = in_time; }
- void SetSenderID(int in_id) { sender_id = in_id; }
- void SetRecipientID(int in_id) { recipient_id = in_id; }
- void SetLabel(int in_label) { label = in_label; }
-
- void SetData(std::string in_data) { data = in_data; }
- void SetData(int in_data);
- void SetData(double in_data);
-
- void GetData(std::string & in_data) { in_data=data; }
- void GetData(int & in_data);
- void GetData(double & in_data);
-};
-
-
-#ifdef ENABLE_UNIT_TESTS
-namespace nOrgMessage {
- /**
- * Run unit tests
- *
- * @param full Run full test suite; if false, just the fast tests.
- **/
- void UnitTests(bool full = false);
-}
-#endif
-
-#endif
Modified: branches/dkdev/source/main/cOrganism.cc
===================================================================
--- branches/dkdev/source/main/cOrganism.cc 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/main/cOrganism.cc 2007-02-20 03:48:20 UTC (rev 1339)
@@ -22,7 +22,6 @@
#include "cInjectGenotype.h"
#include "cInstSet.h"
#include "cInstUtil.h"
-#include "cOrgMessage.h"
#include "cOrgSinkMessage.h"
#include "cStringUtil.h"
#include "cTaskContext.h"
@@ -37,43 +36,41 @@
cOrganism::cOrganism(cWorld* world, cAvidaContext& ctx, const cGenome& in_genome)
: m_world(world)
- , genotype(NULL)
- , phenotype(world)
- , initial_genome(in_genome)
- , mut_info(world->GetEnvironment().GetMutationLib(), in_genome.GetSize())
+ , m_genotype(NULL)
+ , m_phenotype(world)
+ , m_initial_genome(in_genome)
+ , m_mut_info(world->GetEnvironment().GetMutationLib(), in_genome.GetSize())
, m_interface(NULL)
- , input_pointer(0)
- , input_buf(INPUT_BUF_SIZE)
- , output_buf(OUTPUT_BUF_SIZE)
- , send_buf(SEND_BUF_SIZE)
- , receive_buf(RECEIVE_BUF_SIZE)
- , sent_value(0)
- , sent_active(false)
- , test_receive_pos(0)
- , max_executed(-1)
- , lineage_label(-1)
- , lineage(NULL)
- , inbox(0)
- , sent(0)
+ , m_lineage_label(-1)
+ , m_lineage(NULL)
+ , m_input_pointer(0)
+ , m_input_buf(INPUT_BUF_SIZE)
+ , m_output_buf(OUTPUT_BUF_SIZE)
+ , m_send_buf(SEND_BUF_SIZE)
+ , m_receive_buf(RECEIVE_BUF_SIZE)
+ , m_received_messages(RECEIVED_MESSAGES_SIZE)
+ , m_sent_value(0)
+ , m_sent_active(false)
+ , m_test_receive_pos(0)
+ , m_max_executed(-1)
+ , m_is_running(false)
, m_net(NULL)
- , received_messages(RECEIVED_MESSAGES_SIZE)
- , is_running(false)
{
// Initialization of structures...
m_hardware = m_world->GetHardwareManager().Create(this);
- cpu_stats.Setup();
+ m_cpu_stats.Setup();
if (m_world->GetConfig().DEATH_METHOD.Get() > DEATH_METHOD_OFF) {
- max_executed = m_world->GetConfig().AGE_LIMIT.Get();
+ m_max_executed = m_world->GetConfig().AGE_LIMIT.Get();
if (m_world->GetConfig().AGE_DEVIATION.Get() > 0.0) {
- max_executed += (int) (ctx.GetRandom().GetRandNormal() * m_world->GetConfig().AGE_DEVIATION.Get());
+ m_max_executed += (int) (ctx.GetRandom().GetRandNormal() * m_world->GetConfig().AGE_DEVIATION.Get());
}
if (m_world->GetConfig().DEATH_METHOD.Get() == DEATH_METHOD_MULTIPLE) {
- max_executed *= initial_genome.GetSize();
+ m_max_executed *= m_initial_genome.GetSize();
}
- // max_executed must be positive or an organism will not die!
- if (max_executed < 1) max_executed = 1;
+ // m_max_executed must be positive or an organism will not die!
+ if (m_max_executed < 1) m_max_executed = 1;
}
if (m_world->GetConfig().NET_ENABLED.Get()) m_net = new cNetSupport();
@@ -83,7 +80,7 @@
cOrganism::~cOrganism()
{
- assert(is_running == false);
+ assert(m_is_running == false);
delete m_hardware;
delete m_interface;
if (m_net != NULL) delete m_net;
@@ -105,20 +102,20 @@
double cOrganism::GetTestFitness(cAvidaContext& ctx)
{
assert(m_interface);
- return genotype->GetTestFitness(ctx);
+ return m_genotype->GetTestFitness(ctx);
}
int cOrganism::ReceiveValue()
{
assert(m_interface);
const int out_value = m_interface->ReceiveValue();
- receive_buf.Add(out_value);
+ m_receive_buf.Add(out_value);
return out_value;
}
void cOrganism::SellValue(const int data, const int label, const int sell_price)
{
- if (sold_items.GetSize() < 10)
+ if (m_sold_items.GetSize() < 10)
{
assert (m_interface);
m_interface->SellValue(data, label, sell_price, m_id);
@@ -133,7 +130,7 @@
if (receive_value != 0)
{
// put this value in storage place for recieved values
- received_messages.Add(receive_value);
+ m_received_messages.Add(receive_value);
// update loss of buy_price to merit
double cur_merit = GetPhenotype().GetMerit().GetDouble();
cur_merit -= buy_price;
@@ -143,16 +140,11 @@
return receive_value;
}
-tListNode<tListNode<cSaleItem> >* cOrganism::AddSoldItem(tListNode<cSaleItem>* sold_node)
-{
- tListNode<tListNode<cSaleItem> >* node_pt = sold_items.PushRear(sold_node);
- return node_pt;
-}
void cOrganism::DoInput(const int value)
{
- input_buf.Add(value);
- phenotype.TestInput(input_buf, output_buf);
+ m_input_buf.Add(value);
+ m_phenotype.TestInput(m_input_buf, m_output_buf);
}
void cOrganism::DoOutput(cAvidaContext& ctx, const int value)
@@ -171,7 +163,7 @@
cOrganism * cur_neighbor = m_interface->GetNeighbor();
if (cur_neighbor == NULL) continue;
- other_input_list.Push( &(cur_neighbor->input_buf) );
+ other_input_list.Push( &(cur_neighbor->m_input_buf) );
}
}
@@ -183,7 +175,7 @@
cOrganism * cur_neighbor = m_interface->GetNeighbor();
if (cur_neighbor == NULL) continue;
- other_output_list.Push( &(cur_neighbor->output_buf) );
+ other_output_list.Push( &(cur_neighbor->m_output_buf) );
}
}
@@ -191,15 +183,15 @@
if (m_net) net_valid = NetValidate(ctx, value);
// Do the testing of tasks performed...
- output_buf.Add(value);
+ m_output_buf.Add(value);
tArray<double> res_change(resource_count.GetSize());
tArray<int> insts_triggered;
- tBuffer<int>* received_messages_point = &received_messages;
+ tBuffer<int>* received_messages_point = &m_received_messages;
if (!m_world->GetConfig().SAVE_RECEIVED.Get())
received_messages_point = NULL;
- cTaskContext taskctx(input_buf, output_buf, other_input_list, other_output_list, net_valid, 0, received_messages_point);
- phenotype.TestOutput(ctx, taskctx, send_buf, receive_buf, resource_count, res_change, insts_triggered);
+ cTaskContext taskctx(m_input_buf, m_output_buf, other_input_list, other_output_list, net_valid, 0, received_messages_point);
+ m_phenotype.TestOutput(ctx, taskctx, m_send_buf, m_receive_buf, resource_count, res_change, insts_triggered);
m_interface->UpdateResources(res_change);
for (int i = 0; i < insts_triggered.GetSize(); i++) {
@@ -208,24 +200,7 @@
}
}
-void cOrganism::SendMessage(cOrgMessage & mess)
-{
- assert(m_interface);
- if(m_interface->SendMessage(mess))
- sent.Add(mess);
- else
- {
- //perhaps some kind of message error buffer?
- }
-}
-bool cOrganism::ReceiveMessage(cOrgMessage & mess)
-{
- inbox.Add(mess);
- return true;
-}
-
-
void cOrganism::NetGet(cAvidaContext& ctx, int& value, int& seq)
{
assert(m_net);
@@ -356,7 +331,7 @@
cOrganism * cur_neighbor = m_interface->GetNeighbor();
if (cur_neighbor == NULL) continue;
- other_input_list.Push( &(cur_neighbor->input_buf) );
+ other_input_list.Push( &(cur_neighbor->m_input_buf) );
}
}
@@ -368,16 +343,16 @@
cOrganism * cur_neighbor = m_interface->GetNeighbor();
if (cur_neighbor == NULL) continue;
- other_output_list.Push( &(cur_neighbor->output_buf) );
+ other_output_list.Push( &(cur_neighbor->m_output_buf) );
}
}
// Do the testing of tasks performed...
- output_buf.Add(value);
+ m_output_buf.Add(value);
tArray<double> res_change(resource_count.GetSize());
tArray<int> insts_triggered;
- cTaskContext taskctx(input_buf, output_buf, other_input_list, other_output_list, false, completed);
- phenotype.TestOutput(ctx, taskctx, send_buf, receive_buf, resource_count, res_change, insts_triggered);
+ cTaskContext taskctx(m_input_buf, m_output_buf, other_input_list, other_output_list, false, completed);
+ m_phenotype.TestOutput(ctx, taskctx, m_send_buf, m_receive_buf, resource_count, res_change, insts_triggered);
m_interface->UpdateResources(res_change);
for (int i = 0; i < insts_triggered.GetSize(); i++) {
@@ -412,42 +387,36 @@
return m_hardware->InjectHost(label, injected_code);
}
-int cOrganism::OK()
-{
- if (m_hardware->OK() && phenotype.OK()) return true;
- return false;
-}
-
double cOrganism::CalcMeritRatio()
{
- const double age = (double) phenotype.GetAge();
- const double merit = phenotype.GetMerit().GetDouble();
+ const double age = (double) m_phenotype.GetAge();
+ const double merit = m_phenotype.GetMerit().GetDouble();
return (merit > 0.0) ? (age / merit ) : age;
}
-bool cOrganism::GetTestOnDivide() const { return m_interface->TestOnDivide();}
+bool cOrganism::GetTestOnDivide() const { return m_interface->TestOnDivide(); }
bool cOrganism::GetFailImplicit() const { return m_world->GetConfig().FAIL_IMPLICIT.Get(); }
bool cOrganism::GetRevertFatal() const { return m_world->GetConfig().REVERT_FATAL.Get(); }
-bool cOrganism::GetRevertNeg() const { return m_world->GetConfig().REVERT_DETRIMENTAL.Get(); }
-bool cOrganism::GetRevertNeut() const { return m_world->GetConfig().REVERT_NEUTRAL.Get(); }
-bool cOrganism::GetRevertPos() const { return m_world->GetConfig().REVERT_BENEFICIAL.Get(); }
+bool cOrganism::GetRevertNeg() const { return m_world->GetConfig().REVERT_DETRIMENTAL.Get(); }
+bool cOrganism::GetRevertNeut() const { return m_world->GetConfig().REVERT_NEUTRAL.Get(); }
+bool cOrganism::GetRevertPos() const { return m_world->GetConfig().REVERT_BENEFICIAL.Get(); }
-bool cOrganism::GetSterilizeFatal() const{return m_world->GetConfig().STERILIZE_FATAL.Get();}
-bool cOrganism::GetSterilizeNeg() const { return m_world->GetConfig().STERILIZE_DETRIMENTAL.Get(); }
-bool cOrganism::GetSterilizeNeut() const { return m_world->GetConfig().STERILIZE_NEUTRAL.Get();}
-bool cOrganism::GetSterilizePos() const { return m_world->GetConfig().STERILIZE_BENEFICIAL.Get(); }
-double cOrganism::GetNeutralMin() const { return m_world->GetConfig().NEUTRAL_MIN.Get();}
-double cOrganism::GetNeutralMax() const { return m_world->GetConfig().NEUTRAL_MAX.Get();}
+bool cOrganism::GetSterilizeFatal() const { return m_world->GetConfig().STERILIZE_FATAL.Get(); }
+bool cOrganism::GetSterilizeNeg() const { return m_world->GetConfig().STERILIZE_DETRIMENTAL.Get(); }
+bool cOrganism::GetSterilizeNeut() const { return m_world->GetConfig().STERILIZE_NEUTRAL.Get(); }
+bool cOrganism::GetSterilizePos() const { return m_world->GetConfig().STERILIZE_BENEFICIAL.Get(); }
+double cOrganism::GetNeutralMin() const { return m_world->GetConfig().NEUTRAL_MIN.Get(); }
+double cOrganism::GetNeutralMax() const { return m_world->GetConfig().NEUTRAL_MAX.Get(); }
-void cOrganism::PrintStatus(ostream& fp, const cString & next_name)
+void cOrganism::PrintStatus(ostream& fp, const cString& next_name)
{
fp << "---------------------------" << endl;
m_hardware->PrintStatus(fp);
- phenotype.PrintStatus(fp);
+ m_phenotype.PrintStatus(fp);
fp << "---------------------------" << endl;
fp << "ABOUT TO EXECUTE: " << next_name << endl;
}
@@ -459,8 +428,8 @@
const int required_task = m_world->GetConfig().REQUIRED_TASK.Get();
const int immunity_task = m_world->GetConfig().IMMUNITY_TASK.Get();
- if (required_task != -1 && phenotype.GetCurTaskCount()[required_task] == 0) {
- if (immunity_task==-1 || phenotype.GetCurTaskCount()[immunity_task] == 0) {
+ if (required_task != -1 && m_phenotype.GetCurTaskCount()[required_task] == 0) {
+ if (immunity_task==-1 || m_phenotype.GetCurTaskCount()[immunity_task] == 0) {
Fault(FAULT_LOC_DIVIDE, FAULT_TYPE_ERROR,
cStringUtil::Stringf("Lacks required task (%d)", required_task));
return false; // (divide fails)
@@ -468,14 +437,14 @@
}
const int required_reaction = m_world->GetConfig().REQUIRED_REACTION.Get();
- if (required_reaction != -1 && phenotype.GetCurTaskCount()[required_reaction] == 0) {
+ if (required_reaction != -1 && m_phenotype.GetCurTaskCount()[required_reaction] == 0) {
Fault(FAULT_LOC_DIVIDE, FAULT_TYPE_ERROR,
cStringUtil::Stringf("Lacks required reaction (%d)", required_reaction));
return false; // (divide fails)
}
-
+
// Make sure the parent is fertile
- if ( phenotype.IsFertile() == false ) {
+ if ( m_phenotype.IsFertile() == false ) {
Fault(FAULT_LOC_DIVIDE, FAULT_TYPE_ERROR, "Infertile organism");
return false; // (divide fails)
}
@@ -491,7 +460,7 @@
{
assert(m_interface);
// Activate the child! (Keep Last: may kill this organism!)
- return m_interface->Divide(ctx, this, child_genome);
+ return m_interface->Divide(ctx, this, m_child_genome);
}
@@ -503,19 +472,19 @@
#if FATAL_ERRORS
if (fault_type == FAULT_TYPE_ERROR) {
- phenotype.IsFertile() = false;
+ m_phenotype.IsFertile() = false;
}
#endif
#if FATAL_WARNINGS
if (fault_type == FAULT_TYPE_WARNING) {
- phenotype.IsFertile() = false;
+ m_phenotype.IsFertile() = false;
}
#endif
#if BREAKPOINTS
- phenotype.SetFault(fault_desc);
+ m_phenotype.SetFault(fault_desc);
#endif
- phenotype.IncErrors();
+ m_phenotype.IncErrors();
}
Modified: branches/dkdev/source/main/cOrganism.h
===================================================================
--- branches/dkdev/source/main/cOrganism.h 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/main/cOrganism.h 2007-02-20 03:48:20 UTC (rev 1339)
@@ -11,7 +11,7 @@
#ifndef cOrganism_h
#define cOrganism_h
-#include <fstream>
+#include <iostream>
#ifndef cCPUMemory_h
#include "cCPUMemory.h"
@@ -52,65 +52,55 @@
#ifndef tSmartArray_h
#include "tSmartArray.h"
#endif
-#ifndef cSaleItem_h
-#include "cSaleItem.h"
-#endif
-/**
- * The cOrganism class controls the running and manages all the statistics
- * about a creature. Effectively the chemistry acting on the genome.
- **/
class cAvidaContext;
class cCodeLabel;
-class cHardwareBase;
+class cEnvironment;
class cGenotype;
+class cHardwareBase;
class cInjectGenotype;
class cLineage;
-class cOrgMessage;
class cOrgSinkMessage;
-class cEnvironment;
-class cCodeLabel;
+class cSaleItem;
+
class cOrganism
{
protected:
cWorld* m_world;
- cHardwareBase* m_hardware; // The actual machinary running this organism.
- cGenotype* genotype; // Information about organisms with this genome.
- cPhenotype phenotype; // Descriptive attributes of organism.
- const cGenome initial_genome; // Initial genome; can never be changed!
- tArray<cInjectGenotype*> m_parasites; // List of all parasites associated with this organism.
- cMutationRates mut_rates; // Rate of all possible mutations.
- cLocalMutations mut_info; // Info about possible mutations;
- cOrgInterface* m_interface; // Interface back to the population.
- int m_id; // unique id for each org, is just the number it was born
+ cHardwareBase* m_hardware; // The actual machinary running this organism.
+ cGenotype* m_genotype; // Information about organisms with this genome.
+ cPhenotype m_phenotype; // Descriptive attributes of organism.
+ const cGenome m_initial_genome; // Initial genome; can never be changed!
+ tArray<cInjectGenotype*> m_parasites; // List of all parasites associated with this organism.
+ cMutationRates m_mut_rates; // Rate of all possible mutations.
+ cLocalMutations m_mut_info; // Info about possible mutations;
+ cOrgInterface* m_interface; // Interface back to the population.
+ int m_id; // unique id for each org, is just the number it was born
+ int m_lineage_label; // a lineages tag; inherited unchanged in offspring
+ cLineage* m_lineage; // A lineage descriptor... (different from label)
+ // Other stats
+ cCPUMemory m_child_genome; // Child genome, while under construction.
+ sCPUStats m_cpu_stats; // Info for statistics
+
// Input and Output with the environment
- int input_pointer;
- tBuffer<int> input_buf;
- tBuffer<int> output_buf;
- tBuffer<int> send_buf;
- tBuffer<int> receive_buf;
- tBuffer<int> received_messages;
- tList<tListNode<cSaleItem> > sold_items;
+ int m_input_pointer;
+ tBuffer<int> m_input_buf;
+ tBuffer<int> m_output_buf;
+ tBuffer<int> m_send_buf;
+ tBuffer<int> m_receive_buf;
+ tBuffer<int> m_received_messages;
+ tList<tListNode<cSaleItem> > m_sold_items;
// Communication
- int sent_value; // What number is this org sending?
- bool sent_active; // Has this org sent a number?
- int test_receive_pos; // In a test CPU, what message to receive next?
+ int m_sent_value; // What number is this org sending?
+ bool m_sent_active; // Has this org sent a number?
+ int m_test_receive_pos; // In a test CPU, what message to receive next?
- // Other stats
- cCPUMemory child_genome; // Child genome, while under construction.
- sCPUStats cpu_stats; // Info for statistics
-
- int max_executed; // Max number of instruction executed before death.
-
- int lineage_label; // a lineages tag; inherited unchanged in offspring
- cLineage* lineage; // A lineage descriptor... (different from label)
-
- tBuffer<cOrgMessage> inbox;
- tBuffer<cOrgMessage> sent;
+ int m_max_executed; // Max number of instruction executed before death.
+ bool m_is_running; // Does this organism have the CPU?
class cNetSupport
{
@@ -126,12 +116,7 @@
};
cNetSupport* m_net;
-#ifdef DEBUG
- bool initialized; // Has this CPU been initialized yet, w/hardware.
-#endif
- bool is_running; // Does this organism have the CPU?
-
cOrganism(); // @not_implemented
cOrganism(const cOrganism&); // @not_implemented
cOrganism& operator=(const cOrganism&); // @not_implemented
@@ -140,37 +125,72 @@
cOrganism(cWorld* world, cAvidaContext& ctx, const cGenome& in_genome);
~cOrganism();
+ // -------- Accessor Methods --------
+ void SetGenotype(cGenotype* in_genotype) { m_genotype = in_genotype; }
+ cGenotype* GetGenotype() const { return m_genotype; }
+ const cPhenotype& GetPhenotype() const { return m_phenotype; }
+ cPhenotype& GetPhenotype() { return m_phenotype; }
+
+ const cGenome& GetGenome() const { return m_initial_genome; }
+
+ const cMutationRates& MutationRates() const { return m_mut_rates; }
+ cMutationRates& MutationRates() { return m_mut_rates; }
+ const cLocalMutations& GetLocalMutations() const { return m_mut_info; }
+ cLocalMutations& GetLocalMutations() { return m_mut_info; }
+
+ const cOrgInterface& GetOrgInterface() const { assert(m_interface); return *m_interface; }
+ cOrgInterface& GetOrgInterface() { assert(m_interface); return *m_interface; }
+ void SetOrgInterface(cOrgInterface* interface);
+
+ void SetLineageLabel(int in_label) { m_lineage_label = in_label; }
+ int GetLineageLabel() const { return m_lineage_label; }
+ void SetLineage(cLineage* in_lineage) { m_lineage = in_lineage; }
+ cLineage* GetLineage() const { return m_lineage; }
+
+ int GetMaxExecuted() const { return m_max_executed; }
+
+ cCPUMemory& ChildGenome() { return m_child_genome; }
+ sCPUStats& CPUStats() { return m_cpu_stats; }
+
+ void SetRunning(bool in_running) { m_is_running = in_running; }
+ bool IsRunning() { return m_is_running; }
+
+
+ // -------- cOrgInterface Methods --------
cHardwareBase& GetHardware() { return *m_hardware; }
- cOrganism* GetNeighbor() { assert(m_interface); return m_interface->GetNeighbor(); }
- int GetNeighborhoodSize() { assert(m_interface); return m_interface->GetNumNeighbors(); }
- void Rotate(int direction) { assert(m_interface); m_interface->Rotate(direction); }
- void DoBreakpoint() { assert(m_interface); m_interface->Breakpoint(); }
- int GetNextInput() { assert(m_interface); return m_interface->GetInputAt(input_pointer); }
- void Die() { assert(m_interface); m_interface->Die(); }
- void Kaboom(int dist) { assert(m_interface); m_interface->Kaboom(dist);}
- void SpawnDeme() { assert(m_interface); m_interface->SpawnDeme(); }
- int GetCellID() { assert(m_interface); return m_interface->GetCellID(); }
- int GetDebugInfo() { assert(m_interface); return m_interface->Debug(); }
+ cOrganism* GetNeighbor() { return m_interface->GetNeighbor(); }
+ int GetNeighborhoodSize() { return m_interface->GetNumNeighbors(); }
+ void Rotate(int direction) { m_interface->Rotate(direction); }
+ void DoBreakpoint() { m_interface->Breakpoint(); }
+ int GetNextInput() { return m_interface->GetInputAt(m_input_pointer); }
+ void Die() { m_interface->Die(); }
+ void Kaboom(int dist) { m_interface->Kaboom(dist);}
+ void SpawnDeme() { m_interface->SpawnDeme(); }
+ int GetCellID() { return m_interface->GetCellID(); }
+ int GetDebugInfo() { return m_interface->Debug(); }
int GetID() { return m_id; }
- bool GetSentActive() { return sent_active; }
- void SendValue(int value) { sent_active = true; sent_value = value; }
- int RetrieveSentValue() { sent_active = false; return sent_value; }
+ bool GetSentActive() { return m_sent_active; }
+ void SendValue(int value) { m_sent_active = true; m_sent_value = value; }
+ int RetrieveSentValue() { m_sent_active = false; return m_sent_value; }
int ReceiveValue();
void SellValue(const int data, const int label, const int sell_price);
int BuyValue(const int label, const int buy_price);
- tListNode<tListNode<cSaleItem> >* AddSoldItem(tListNode<cSaleItem>* );
- tList<tListNode<cSaleItem> >* GetSoldItems() { return &sold_items; }
- void UpdateMerit(double new_merit) { assert(m_interface); m_interface->UpdateMerit(new_merit); }
+ tListNode<tListNode<cSaleItem> >* AddSoldItem(tListNode<cSaleItem>* node) { return m_sold_items.PushRear(node); }
+ tList<tListNode<cSaleItem> >* GetSoldItems() { return &m_sold_items; }
+ void UpdateMerit(double new_merit) { m_interface->UpdateMerit(new_merit); }
- // Input & Output Testing
+
+ // -------- Input and Output Methods --------
void DoInput(const int value);
void DoOutput(cAvidaContext& ctx, const int value);
- // Message stuff
- void SendMessage(cOrgMessage & mess);
- bool ReceiveMessage(cOrgMessage & mess);
+
+ // -------- Divide Methods --------
+ bool Divide_CheckViable();
+ bool ActivateDivide(cAvidaContext& ctx);
- // Network Stuff
+
+ // -------- Networking Support --------
void NetGet(cAvidaContext& ctx, int& value, int& seq);
void NetSend(cAvidaContext& ctx, int value);
cOrgSinkMessage* NetPop() { return m_net->pending.PopRear(); }
@@ -180,6 +200,8 @@
int NetLast() { return m_net->last_seq; }
void NetReset();
+
+ // -------- Parasite Interactions --------
bool InjectParasite(const cGenome& genome);
bool InjectHost(const cCodeLabel& in_label, const cGenome& genome);
void AddParasite(cInjectGenotype* cur) { m_parasites.Push(cur); }
@@ -187,34 +209,37 @@
int GetNumParasites() { return m_parasites.GetSize(); }
void ClearParasites() { m_parasites.Resize(0); }
- int OK();
+ // -------- Support Methods --------
double GetTestFitness(cAvidaContext& ctx);
double CalcMeritRatio();
+
+ void PrintStatus(std::ostream& fp, const cString & next_name);
+ void Fault(int fault_loc, int fault_type, cString fault_desc="");
- cCPUMemory& ChildGenome() { return child_genome; }
- sCPUStats& CPUStats() { return cpu_stats; }
- bool TestCopyMut(cAvidaContext& ctx) const { return MutationRates().TestCopyMut(ctx); }
- bool TestDivideMut(cAvidaContext& ctx) const { return MutationRates().TestDivideMut(ctx); }
- bool TestDivideIns(cAvidaContext& ctx) const { return MutationRates().TestDivideIns(ctx); }
- bool TestDivideDel(cAvidaContext& ctx) const { return MutationRates().TestDivideDel(ctx); }
- bool TestParentMut(cAvidaContext& ctx) const { return MutationRates().TestParentMut(ctx); }
+ // -------- Mutation Rate Convenience Methods --------
+ bool TestCopyMut(cAvidaContext& ctx) const { return m_mut_rates.TestCopyMut(ctx); }
+ bool TestDivideMut(cAvidaContext& ctx) const { return m_mut_rates.TestDivideMut(ctx); }
+ bool TestDivideIns(cAvidaContext& ctx) const { return m_mut_rates.TestDivideIns(ctx); }
+ bool TestDivideDel(cAvidaContext& ctx) const { return m_mut_rates.TestDivideDel(ctx); }
+ bool TestParentMut(cAvidaContext& ctx) const { return m_mut_rates.TestParentMut(ctx); }
- double GetCopyMutProb() const { return MutationRates().GetCopyMutProb(); }
- void SetCopyMutProb(double _p) { return MutationRates().SetCopyMutProb(_p); }
- void SetDivMutProb(double _p) { return MutationRates().SetDivMutProb(_p); }
+ double GetCopyMutProb() const { return m_mut_rates.GetCopyMutProb(); }
+ void SetCopyMutProb(double _p) { return m_mut_rates.SetCopyMutProb(_p); }
+ void SetDivMutProb(double _p) { return m_mut_rates.SetDivMutProb(_p); }
- double GetInsMutProb() const { return MutationRates().GetInsMutProb(); }
- double GetDelMutProb() const { return MutationRates().GetDelMutProb(); }
- double GetDivMutProb() const { return MutationRates().GetDivMutProb(); }
- double GetParentMutProb() const { return MutationRates().GetParentMutProb();}
+ double GetInsMutProb() const { return m_mut_rates.GetInsMutProb(); }
+ double GetDelMutProb() const { return m_mut_rates.GetDelMutProb(); }
+ double GetDivMutProb() const { return m_mut_rates.GetDivMutProb(); }
+ double GetParentMutProb() const { return m_mut_rates.GetParentMutProb();}
- double GetInjectInsProb() const { return MutationRates().GetInjectInsProb(); }
- double GetInjectDelProb() const { return MutationRates().GetInjectDelProb(); }
- double GetInjectMutProb() const { return MutationRates().GetInjectMutProb(); }
+ double GetInjectInsProb() const { return m_mut_rates.GetInjectInsProb(); }
+ double GetInjectDelProb() const { return m_mut_rates.GetInjectDelProb(); }
+ double GetInjectMutProb() const { return m_mut_rates.GetInjectMutProb(); }
+ // -------- Configuration Convenience Methods --------
bool GetTestOnDivide() const;
bool GetFailImplicit() const;
@@ -229,49 +254,6 @@
bool GetSterilizePos() const;
double GetNeutralMin() const;
double GetNeutralMax() const;
-
- // Access to private variables
- int GetMaxExecuted() const { return max_executed; }
-
- void SetLineageLabel( int in_label ) { lineage_label = in_label; }
- int GetLineageLabel() const { return lineage_label; }
-
- void SetLineage( cLineage * in_lineage ) { lineage = in_lineage; }
- cLineage * GetLineage() const { return lineage; }
-
- void SetGenotype(cGenotype * in_genotype) { genotype = in_genotype; }
- cGenotype * GetGenotype() const { return genotype; }
-
- const cMutationRates& MutationRates() const { return mut_rates; }
- cMutationRates& MutationRates() { return mut_rates; }
- const cLocalMutations& GetLocalMutations() const { return mut_info; }
- cLocalMutations& GetLocalMutations() { return mut_info; }
-
- const cOrgInterface& GetOrgInterface() const { assert(m_interface); return *m_interface; }
- cOrgInterface& GetOrgInterface() { assert(m_interface); return *m_interface; }
- void SetOrgInterface(cOrgInterface* interface);
-
- const cGenome& GetGenome() const { return initial_genome; }
-
- /*
- int GetCurGestation() const;
- */
- const cPhenotype & GetPhenotype() const { return phenotype; }
- cPhenotype & GetPhenotype() { return phenotype; }
-
- // -------- DEBUG ---------
- void SetRunning(bool in_running) { is_running = in_running; }
- bool GetIsRunning() { return is_running; }
-
-
- void PrintStatus(std::ostream& fp, const cString & next_name);
-
- // Divide functions
- bool Divide_CheckViable();
- bool ActivateDivide(cAvidaContext& ctx);
-
- // Other Special Functions
- void Fault(int fault_loc, int fault_type, cString fault_desc="");
};
Modified: branches/dkdev/source/main/cPopulation.cc
===================================================================
--- branches/dkdev/source/main/cPopulation.cc 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/main/cPopulation.cc 2007-02-20 03:48:20 UTC (rev 1339)
@@ -32,6 +32,7 @@
#include "cPopulationCell.h"
#include "cProbSchedule.h"
#include "cResource.h"
+#include "cSaleItem.h"
#include "cSpecies.h"
#include "cStats.h"
#include "cTaskEntry.h"
@@ -409,7 +410,7 @@
// And clear it!
in_cell.RemoveOrganism();
- if (!organism->GetIsRunning()) delete organism;
+ if (!organism->IsRunning()) delete organism;
else organism->GetPhenotype().SetToDelete();
// Alert the scheduler that this cell has a 0 merit.
Modified: branches/dkdev/source/main/cPopulationInterface.cc
===================================================================
--- branches/dkdev/source/main/cPopulationInterface.cc 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/main/cPopulationInterface.cc 2007-02-20 03:48:20 UTC (rev 1339)
@@ -13,7 +13,6 @@
#include "cGenotype.h"
#include "cHardwareManager.h"
#include "cOrganism.h"
-#include "cOrgMessage.h"
#include "cOrgSinkMessage.h"
#include "cPopulation.h"
#include "cPopulationCell.h"
@@ -112,17 +111,6 @@
m_world->GetPopulation().SpawnDeme(deme_id);
}
-bool cPopulationInterface::SendMessage(cOrgMessage & mess)
-{
- mess.SetSenderID(m_cell_id);
- mess.SetTime(m_world->GetStats().GetUpdate());
- cPopulationCell& cell = m_world->GetPopulation().GetCell(m_cell_id);
- if(cell.ConnectionList().GetFirst() == NULL)
- return false;
- mess.SetRecipientID(cell.ConnectionList().GetFirst()->GetID());
- return cell.ConnectionList().GetFirst()->GetOrganism()->ReceiveMessage(mess);
-}
-
cOrgSinkMessage* cPopulationInterface::NetReceive()
{
cPopulationCell& cell = m_world->GetPopulation().GetCell(m_cell_id);
Modified: branches/dkdev/source/main/cPopulationInterface.h
===================================================================
--- branches/dkdev/source/main/cPopulationInterface.h 2007-02-20 01:58:06 UTC (rev 1338)
+++ branches/dkdev/source/main/cPopulationInterface.h 2007-02-20 03:48:20 UTC (rev 1339)
@@ -54,7 +54,6 @@
void Die();
void Kaboom(int distance);
void SpawnDeme();
- bool SendMessage(cOrgMessage& mess);
cOrgSinkMessage* NetReceive();
bool NetRemoteValidate(cAvidaContext& ctx, cOrgSinkMessage* msg);
int ReceiveValue();
More information about the Avida-cvs
mailing list