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

Method MakeTopPred

avida-core/source/cpu/cHardwareExperimental.cc:6926–6938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6924}
6925
6926void cHardwareExperimental::MakeTopPred(cAvidaContext& ctx)
6927{
6928 if (m_organism->IsPreyFT()) {
6929 if (m_world->GetConfig().MAX_PRED.Get() && m_world->GetStats().GetNumTotalPredCreatures() >= m_world->GetConfig().MAX_PRED.Get()) m_organism->GetOrgInterface().KillRandPred(ctx, m_organism);
6930 // switching between predator and prey means having to switch avatar list...don't run this for orgs with AVCell == -1 (avatars off or test cpu)
6931 if (m_use_avatar && m_organism->GetOrgInterface().GetAVCellID() != -1) {
6932 m_organism->GetOrgInterface().SwitchPredPrey(ctx);
6933 m_organism->SetTopPredFT(ctx);
6934 }
6935 else m_organism->SetTopPredFT(ctx);
6936 }
6937 else if (m_organism->IsPredFT()) m_organism->SetTopPredFT(ctx);
6938}
6939
6940bool cHardwareExperimental::TestAttack(cAvidaContext& ctx)
6941{

Callers

nothing calls this directly

Calls 10

IsPreyFTMethod · 0.80
GetConfigMethod · 0.80
SetTopPredFTMethod · 0.80
IsPredFTMethod · 0.80
GetMethod · 0.45
GetStatsMethod · 0.45
KillRandPredMethod · 0.45
GetAVCellIDMethod · 0.45
SwitchPredPreyMethod · 0.45

Tested by

no test coverage detected