| 4512 | } |
| 4513 | |
| 4514 | bool cHardwareCPU::Inst_SenseDiffFaced(cAvidaContext& ctx) |
| 4515 | { |
| 4516 | const Apto::Array<double> res_count = m_organism->GetOrgInterface().GetResources(ctx); |
| 4517 | if(m_organism->GetOrgInterface().HasOpinion(m_organism)) { |
| 4518 | int opinion = m_organism->GetOpinion().first; |
| 4519 | int reg_to_set = FindModifiedRegister(REG_BX); |
| 4520 | double faced_res = m_organism->GetOrgInterface().GetFacedCellResources(ctx)[opinion]; |
| 4521 | // return % change |
| 4522 | int res_diff = 0; |
| 4523 | if (res_count[opinion] == 0) res_diff = (int) faced_res; |
| 4524 | else res_diff = (int) (((faced_res - res_count[opinion])/res_count[opinion]) * 100 + 0.5); |
| 4525 | GetRegister(reg_to_set) = res_diff; |
| 4526 | } |
| 4527 | return true; |
| 4528 | } |
| 4529 | |
| 4530 | |
| 4531 | bool cHardwareCPU::Inst_SenseFacedHabitat(cAvidaContext& ctx) |
nothing calls this directly
no test coverage detected