需要简单代码的帮助
Need help for simple code
我想创建一个变量,在那个邻居补丁上有海龟的邻居是收入为 X 的海龟。下面的代码是我到目前为止尝试过的,当然它仍然没有用。
请帮忙。
Let Neighbors1 Neighbors with [turtles-on with [income = "High"]]
改用turtles-here
:
turtles-own [income]
to setup
ca
crt 200 [
set income one-of ["Low" "High"]
setxy random-xcor random-ycor
]
end
to test
ask turtles [
let _nbrs neighbors with [any? turtles-here with [income = "High"]]
show _nbrs
]
end
我想创建一个变量,在那个邻居补丁上有海龟的邻居是收入为 X 的海龟。下面的代码是我到目前为止尝试过的,当然它仍然没有用。 请帮忙。
Let Neighbors1 Neighbors with [turtles-on with [income = "High"]]
改用turtles-here
:
turtles-own [income]
to setup
ca
crt 200 [
set income one-of ["Low" "High"]
setxy random-xcor random-ycor
]
end
to test
ask turtles [
let _nbrs neighbors with [any? turtles-here with [income = "High"]]
show _nbrs
]
end