乌龟死后如何加分

时间:2014-01-16 01:17:28

标签: netlogo

所以我现在的程序是

to Go
  ask turtles with [is-moving?]

  [
    if any? other turtles-here [
      ask other turtles-here [
        die
      ]
    ]
  ]
end

(is-moving?只是一个海龟自己的变量来指定我想要移动的唯一的乌龟)

我想在每次进入go程序时加上5分,并且一只乌龟死了。我已经设置了一个全局变量来得分。谢谢!

1 个答案:

答案 0 :(得分:1)

如果得分是全局变量,只需添加set score Score + 5

to Go
  ask turtles with [is-moving?]

  [
    if any? other turtles-here [

      ask other turtles-here [
 set score Score + 5
        die

      ]
    ]
  ]
end

<强>更新

我认为你不需要繁殖它,因为所有的海龟都会更新得分值! (我的错误!)监控分数:

enter image description here