distance - NetLogo: select a patch with neighbors having certain qualities? -


i want let turtle move patch , make "splotch". central patch = turtle location, can selected randomly, satisfy 2 conditions:

  • has in distance turtle's actual position
  • has surrounded (neighbors in radius) patches specific quality

the reason create kind of "buffers" around turtle's position, aim obstruct close proximity of clumps.

please, how can satisfy these 2 conditions?

as far, have:

to go  ask turtles [                     ; select 1 of patches in specific distance, ,     ; surrounded patches no magenta color    let aaa one-of patches [distance myself > 3 ,           all? neighbors [pcolor != magenta]]                        ; how write condition above ??                        ; , how replace "neighbors" "in-radius"??    move-to aaa    ask neighbors [           ; create clump of magenta patches      set pcolor magenta ]    ask patch-here [          ; set central patch magenta      set pcolor magenta ]  ] 

enter image description here

you're there; need reread documentation all? , any?.

let _candidates patches [distance myself > 3] set _candidates _candidates [   not any? (patches in-radius 3 [pcolor = magenta]) ] let aaa one-of _candidates 

if possible there no candidates, should guard against that.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -