Sense if the cell faced is a target -- put 1 in reg is so, 0 otherwise
| 8544 | |
| 8545 | // Sense if the cell faced is a target -- put 1 in reg is so, 0 otherwise |
| 8546 | bool cHardwareCPU::Inst_SenseTargetFaced(cAvidaContext&) |
| 8547 | { |
| 8548 | int reg_to_set = FindModifiedRegister(REG_CX); |
| 8549 | |
| 8550 | cPopulation& pop = m_world->GetPopulation(); |
| 8551 | int cellid = m_organism->GetCellID(); |
| 8552 | |
| 8553 | if (cellid == -1) { |
| 8554 | return false; |
| 8555 | } |
| 8556 | |
| 8557 | cPopulationCell& mycell = pop.GetCell(cellid); |
| 8558 | |
| 8559 | int cell_data = mycell.GetCellFaced().GetCellData(); //absolute id of faced cell |
| 8560 | int val = 0; |
| 8561 | |
| 8562 | if (cell_data > 0) { |
| 8563 | val = 1; |
| 8564 | } |
| 8565 | |
| 8566 | GetRegister(reg_to_set) = val; |
| 8567 | |
| 8568 | return true; |
| 8569 | } //End Inst_SenseTargetFaced() |
| 8570 | |
| 8571 | |
| 8572 | // DoSensePheromone -- modified version of DoSense to only sense from |
nothing calls this directly
no test coverage detected