Line of sight NetLogo -
Line of sight NetLogo -
how implement line of sight in netlogo whereby
a turtle calculates/counts turtles between , given patch on line of sight.
thanks.
let's each turtle has turtles-own called target, given patch, can inquire each turtle face target patch , count turtles between , given patch:
ask turtles [ face target allow n 1 allow c 0 while [patch-ahead (n - 1) != target][ inquire patch-ahead n [ if any? turtles-here [set c (c + 1)] ] set n (n + 1) ] print (word " has " c " turtles on line of sight") ] a while loop doesn't clean in netlogo works.
netlogo
Comments
Post a Comment