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

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -