Hi,
I've been trying since yesterday to code the following: l have a world with 1 turtle in each patch (sprout command). I would like the turtle to check the 8 neighbors from the patch it is in. I did it like this: let neighWithVeg count neighbors of patch-here with [veg-value > 0.2]. But the error appears: WITH expected this input to be an agentset, but got a patch instead
Can someone help me?
globals [
edge-size
]
patches-own [
veg-value
]
to setup
clear-all
reset-ticks
set edge-size 30
set-patch-size 21
ask patches [
set pcolor green
sprout 1
;set veg-values random min min-veg random max max-veg-dist
set veg-value random-in-range -3 1
]
ask turtles [
set size 1
set color black
]
end
to-report random-in-range [low high] ;; limit random-in-range
report low + random (high - low + 1)
end
to go
ask turtles [
neighboring
]
end
to neighboring
let neighWithVeg count neighbors of patch-here with [veg-value > 0.2] ifelse neighWithVeg = 0
[
move
]
[
move-to one-of neighbors of patch-here with [veg-value > 0.2]
]
end