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

Method Inst_SmartExplode

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

Source from the content-addressed store, hash-verified

3636}
3637
3638bool cHardwareCPU::Inst_SmartExplode(cAvidaContext& ctx)
3639{
3640 if (GetRegister(FindModifiedRegister(REG_AX))){
3641 // execute explode chance
3642 m_organism->GetPhenotype().SetKaboomExecuted(true);
3643 //Case where both Probability and Hamming Distance are static
3644 double percent_prob = (double) m_world->GetConfig().KABOOM_PROB.Get();
3645 int distance = (int) m_world->GetConfig().KABOOM_HAMMING.Get();
3646 if ( ctx.GetRandom().P(percent_prob) ) m_organism->Kaboom(distance, ctx);
3647 } else {
3648 m_world->GetStats().IncDontExplode();
3649 }
3650 return true;
3651}
3652
3653
3654bool cHardwareCPU::Inst_Lyse(cAvidaContext& ctx)

Callers

nothing calls this directly

Calls 6

SetKaboomExecutedMethod · 0.80
GetConfigMethod · 0.80
IncDontExplodeMethod · 0.80
GetMethod · 0.45
KaboomMethod · 0.45
GetStatsMethod · 0.45

Tested by

no test coverage detected