NetLogo:补丁,用于显示补丁上的海龟数量

时间:2013-12-16 22:27:23

标签: netlogo

我想让每个补丁显示该补丁中的海龟数量。我知道我需要使用plabel命令,但我无法弄清楚如何告诉补丁显示占用它的海龟的总和。有谁知道怎么做?

1 个答案:

答案 0 :(得分:3)

你可以通过“count turtles-here”轻松地做到这一点

to setup
  Clear-all
  Create-turtles 50 [move-to patch random 30 random 30]

  reset-ticks
end


to set-label

  ask patches [
    ifelse count turtles-here > 0 
    [set plabel count turtles-here]
    [set plabel ""]
  ]

end

to go
  ask turtles
  [rt random 5
    fd 0.3]
  set-label
  tick
end

我添加了一个工作示例,但您的答案是“set plabel count turtles-here

相关问题