【问题标题】:How to make turtles move in one color in Netlogo如何让海龟在 Netlogo 中以一种颜色移动
【发布时间】:2016-12-01 12:47:25
【问题描述】:

我开始使用 Netlogo 进行开发,我面临的问题是我想让所有 Turtles 以一种具有黑色的方式移动。我怎样才能做到这一点 ?我尝试了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

【问题讨论】:

  • import-drawing "patch.png" 不会改变 pcolor 值,请改用 'import-pcolors "patch.png"'。
  • @Marzy 抱歉回复晚了!非常感谢,它确实有效:)

标签: netlogo


【解决方案1】:

你应该使用这样的东西:

使用 [pcolor = black] 设置黑色补丁补丁

问海龟 [ 面对一个黑斑 ]

最好的,欧文

【讨论】:

    猜你喜欢
    • 2017-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多