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

Method Inst_TaskGet2

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

@JEB - this instruction does more than two "gets" together, it also resets the inputs

Source from the content-addressed store, hash-verified

4132
4133// @JEB - this instruction does more than two "gets" together, it also resets the inputs
4134bool cHardwareCPU::Inst_TaskGet2(cAvidaContext& ctx)
4135{
4136 // Randomize the inputs so they can't save numbers
4137 m_organism->GetOrgInterface().ResetInputs(ctx); // Now re-randomize the inputs this organism sees
4138 m_organism->ClearInput(); // Also clear their input buffers, or they can still claim
4139 // rewards for numbers no longer in their environment!
4140
4141 const int reg_used_1 = FindModifiedRegister(REG_BX);
4142 const int reg_used_2 = FindNextRegister(reg_used_1);
4143
4144 const int value1 = m_organism->GetNextInput();
4145 GetRegister(reg_used_1) = value1;
4146 m_organism->DoInput(value1);
4147
4148 const int value2 = m_organism->GetNextInput();
4149 GetRegister(reg_used_2) = value2;
4150 m_organism->DoInput(value2);
4151
4152 return true;
4153}
4154
4155bool cHardwareCPU::Inst_TaskStackGet(cAvidaContext&)
4156{

Callers

nothing calls this directly

Calls 4

ClearInputMethod · 0.80
GetNextInputMethod · 0.80
ResetInputsMethod · 0.45
DoInputMethod · 0.45

Tested by

no test coverage detected