我如何找出 Netlogo 中海龟之间的距离,以便我可以做一些操作
How do I find out the distance between turtles in Netlogo so as I can do some operations
我正在编写一个 Net-logo 模拟,其中我有以下条件
"One turtle is green in color and rest of the others are in grey now I need to fire a query that if a grey agent comes in contact of green agent than its color changes"
let green-agent one-of turtles with [color = green]
ask turtles with [color = grey and distance green-agent < 1] [set color (random 255)
假设我们假设 "comes in contact" 表示 "stands on the same patch with",假设我们假设 "its color changes" 表示 "it turns red"。那么:
ask turtles [
if any? other turtles-here with [color = green] [
set color red
]
]
我正在编写一个 Net-logo 模拟,其中我有以下条件
"One turtle is green in color and rest of the others are in grey now I need to fire a query that if a grey agent comes in contact of green agent than its color changes"
let green-agent one-of turtles with [color = green]
ask turtles with [color = grey and distance green-agent < 1] [set color (random 255)
假设我们假设 "comes in contact" 表示 "stands on the same patch with",假设我们假设 "its color changes" 表示 "it turns red"。那么:
ask turtles [
if any? other turtles-here with [color = green] [
set color red
]
]