I'm building interactions for a prey-predator model.
I have a prey that changes color based on the state that it is currently in. The state that I'm working on is "hiding", in which the prey is yellow. I have a predator working to evaluate if it can chase a prey, I'm attempting to do this by evaluating the color of the prey but it doesn't seem to be working.
to chase
let target min-one-of prey [distance myself]
output-print target
ifelse target != yellow
[
output-print "chase"
]
[
output-print "ignore"
]
end
When I run the model the predator constantly prints "chase" - regardless of whether the prey is "hiding" or not.
Here is the hiding function.
to hiding
set color yellow
set energy (energy - 1)
if (count predators = 0)
[
output-print "safe"
]
end
Any help would be appreciated.