| 1294 | } |
| 1295 | |
| 1296 | void cOrgSensor::GetConfusionOddsDensity(cAvidaContext& ctx, double& odds, cOrganism* first_org) |
| 1297 | { |
| 1298 | int prey_count = 0; |
| 1299 | Apto::Array<int> neighborhood; |
| 1300 | if (!m_use_avatar) { |
| 1301 | if (first_org->IsPreyFT()) { |
| 1302 | prey_count++; |
| 1303 | first_org->GetOrgInterface().GetNeighborhoodCellIDs(neighborhood); |
| 1304 | for (int j = 0; j < neighborhood.GetSize(); j++) { |
| 1305 | if (first_org->GetOrgInterface().GetCell(neighborhood[j])->IsOccupied() && |
| 1306 | !first_org->GetOrgInterface().GetCell(neighborhood[j])->GetOrganism()->IsDead()) { |
| 1307 | if (first_org->GetOrgInterface().GetCell(neighborhood[j])->GetOrganism()->IsPreyFT()) prey_count++; |
| 1308 | } |
| 1309 | } |
| 1310 | } |
| 1311 | } |
| 1312 | else { |
| 1313 | prey_count += first_org->GetOrgInterface().GetCell(first_org->GetOrgInterface().GetAVCellID())->GetNumPreyAV(); // self cell |
| 1314 | first_org->GetOrgInterface().GetAVNeighborhoodCellIDs(neighborhood); |
| 1315 | for (int j = 0; j < neighborhood.GetSize(); j++) { |
| 1316 | prey_count += first_org->GetOrgInterface().GetCell(neighborhood[j])->GetNumPreyAV(); |
| 1317 | } |
| 1318 | } |
| 1319 | |
| 1320 | // first org is alone and doesn't count: |
| 1321 | prey_count--; |
| 1322 | odds = 1.0 - (0.10 * (double) prey_count); // 0 friend = 0% confusion, 1 friend = 10%, 10 friends = 100% |
| 1323 | } |
| 1324 | |
| 1325 | void cOrgSensor::GetConfusionOddsFacings(cAvidaContext& ctx, double& odds, cOrganism* first_org) |
| 1326 | { |
nothing calls this directly
no test coverage detected