Sense if the organism is on a target -- put 1 in reg is so, 0 otherwise
| 8521 | |
| 8522 | // Sense if the organism is on a target -- put 1 in reg is so, 0 otherwise |
| 8523 | bool cHardwareCPU::Inst_SenseTarget(cAvidaContext&) |
| 8524 | { |
| 8525 | int reg_to_set = FindModifiedRegister(REG_CX); |
| 8526 | int cellid = m_organism->GetCellID(); |
| 8527 | |
| 8528 | if (cellid == -1) { |
| 8529 | return false; |
| 8530 | } |
| 8531 | |
| 8532 | int cell_data = m_world->GetPopulation().GetCell(cellid).GetCellData(); |
| 8533 | int val = 0; |
| 8534 | |
| 8535 | if (cell_data > 0) { |
| 8536 | val = 1; |
| 8537 | } |
| 8538 | |
| 8539 | GetRegister(reg_to_set) = val; |
| 8540 | |
| 8541 | return true; |
| 8542 | } //End Inst_SenseTarget() |
| 8543 | |
| 8544 | |
| 8545 | // Sense if the cell faced is a target -- put 1 in reg is so, 0 otherwise |
nothing calls this directly
no test coverage detected