MCPcopy Create free account
hub / github.com/devosoft/avida / Inst_Sleep

Method Inst_Sleep

avida-core/source/cpu/cHardwareCPU.cc:7670–7683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7668
7669
7670bool cHardwareCPU::Inst_Sleep(cAvidaContext& ctx)
7671{
7672 m_organism->SetSleeping(false); //this instruction get executed at the end of a sleep cycle
7673
7674 cPhenotype& phenotype = m_organism->GetPhenotype();
7675 if (m_world->GetConfig().APPLY_ENERGY_METHOD.Get() == 2) {
7676 phenotype.RefreshEnergy();
7677 phenotype.ApplyToEnergyStore();
7678 double newMerit = phenotype.ConvertEnergyToMerit(phenotype.GetStoredEnergy() * phenotype.GetEnergyUsageRatio());
7679 m_organism->UpdateMerit(ctx, newMerit);
7680 }
7681
7682 return true;
7683}
7684
7685bool cHardwareCPU::Inst_GetUpdate(cAvidaContext&)
7686{

Callers

nothing calls this directly

Calls 9

SetSleepingMethod · 0.80
GetConfigMethod · 0.80
RefreshEnergyMethod · 0.80
ApplyToEnergyStoreMethod · 0.80
ConvertEnergyToMeritMethod · 0.80
GetStoredEnergyMethod · 0.80
GetEnergyUsageRatioMethod · 0.80
GetMethod · 0.45
UpdateMeritMethod · 0.45

Tested by

no test coverage detected