如何让海龟在 Netlogo 中以一种颜色移动
How to make turtles move in one color in Netlogo
我开始使用 Netlogo 进行开发,但我遇到了一个问题,即我想让所有 Turtle 以一种具有黑色的方式移动。我怎样才能做到这一点 ?我尝试使用 patch-ahead 但没有成功。
有人有解决办法吗?我将不胜感激。
to setup
clear-all
import-drawing "patch.png"
create-turtles 10 [set xcor -10 set ycor -13]
ask turtles [set color white]
ask turtles [set shape "bug"]
reset-ticks
end
to bouge
ask turtles[
fd 1
]
end
to go
bouge
ask turtles [if [pcolor] of patch-ahead 6 != black [set heading heading - 100] ]
end
enter image description here
你应该使用这样的东西:
使用 [pcolor = black]
设置黑色补丁
问海龟[
面对一个黑色补丁
]
最佳,欧文
我开始使用 Netlogo 进行开发,但我遇到了一个问题,即我想让所有 Turtle 以一种具有黑色的方式移动。我怎样才能做到这一点 ?我尝试使用 patch-ahead 但没有成功。 有人有解决办法吗?我将不胜感激。
to setup
clear-all
import-drawing "patch.png"
create-turtles 10 [set xcor -10 set ycor -13]
ask turtles [set color white]
ask turtles [set shape "bug"]
reset-ticks
end
to bouge
ask turtles[
fd 1
]
end
to go
bouge
ask turtles [if [pcolor] of patch-ahead 6 != black [set heading heading - 100] ]
end
enter image description here
你应该使用这样的东西:
使用 [pcolor = black]
设置黑色补丁问海龟[ 面对一个黑色补丁 ]
最佳,欧文