I am working with Netlogo to create a realistic predator prey-model and am stumped at the distance command.
ifelse any? sheep in-radius senserange [
let prey min-one-of sheep in-radius senserange [distance myself]
**ifelse [distance prey] < speedrange**
[move-to prey
let addenergy [energy] of prey
ask prey [die]
set energy energy + (addenergy * energy-gain-from-sheep)
rt 180
fd speedrange
]
[set heading towards prey
fd speedrange
]
]
[wiggle
fd 1]
The code in bold is the problem: I want the wolves not to immediately go to the prey but move towards it in an increment of its speedrange, unless of course it is within that range, then run to it and grab it ;).
I get ERROR: "Expected an agent or number or string here, rather than a list or block"
I think it is with the distance command, I've also tried something like this
ifelse prey in-radius speedrange [distance myself]
Thsi version results in ERROR: "IFELSE expected this input to be a T/F but got a turtle agentset or patch agentset instead