I am writing a predator-prey model where the predator has a small internal machine learning model to decide which habitat it is going to hunt in.
If the predator has not had a successful hunt the day prior they assign themselves on of four strategies randomly. Each strategy has a unique habitat they can hunt in however despite they all move from random areas of the environment into a central location and then "paint it" with pen mode down and ignore the all other parts of the environment, I cannot figure out why.
I have tried many combinations of code to fix this and it always does the same thing. My latest attempt is the following
if strat = "strat1" [ifelse any? patches in-cone 0 250 with [habitat = "rugged slope"]
[set target-patch min-one-of patches in-cone 0 250 with [habitat = "rugged slope"] [distance myself]
face target-patch
fd 1]
[face one-of patches with [habitat = "rugged slope"]
fd 1]]
if strat = "strat2" [ifelse any? patches in-cone 0 250 with [habitat = "gentle slope"]
[set target-patch min-one-of patches in-cone 0 250 with [habitat = "gentle slope"] [distance myself]
face target-patch
fd 1]
[face one-of patches with [habitat = "gentle slope"]
fd 1]]
if strat = "strat3" [ifelse any? patches in-cone 0 250 with [habitat = "rugged forest"]
[set target-patch min-one-of patches in-cone 0 250 with [habitat = "rugged forest"] [distance myself]
face target-patch
fd 1]
[face one-of patches with [habitat = "rugged forest"]
fd 1]]
if strat = "strat4" [ifelse any? patches in-cone 0 250 with [habitat = "gentle forest"]
[set target-patch min-one-of patches in-cone 0 250 with [habitat = "gentle forest"] [distance myself]
face target-patch
fd 1]
[face one-of patches with [habitat = "gentle forest"]
fd 1]]
]
end
As you can see they are being told to go to certain areas but the result looks like this (picture attached)
The predators leave their den (pink) and despite having unique commands on where to go they simply meet in the middle and paint.