【问题标题】:NetLogo - How to show the current coordinates of a turtleNetLogo - 如何显示海龟的当前坐标
【发布时间】:2012-01-31 11:35:20
【问题描述】:

我一直在尝试在 NetLogo 中显示乌龟的当前坐标。我知道要显示其中一个坐标,我可以使用:

show [xcor] of turtle 0

show [ycor] of turtle 0

但是如何显示两个坐标呢?

谢谢。

【问题讨论】:

    标签: netlogo


    【解决方案1】:

    你可以show [list xcor ycor] of turtle 0

    或者,更高级的:show [(word "(" xcor ", " ycor ")")] of turtle 0

    【讨论】:

      【解决方案2】:

      如果您不知道确切的海龟 (of turtle 5) 的坐标,但您想确定运行进程的特定海龟的位置,您可以使用

      show list xcor ycor  ; not need to use self or myself
      

      【讨论】:

      • 这可以简化为show list xcor ycor。它永远不会增加使用 of self 的意义
      • 谢谢@SethTisue,我已经在我的代码中修改了:)
      【解决方案3】:

      http://ccl.northwestern.edu/netlogo/docs/programming.html#syntax

      你可以的

      显示乌龟 5 的 [xcor + ycor]

      但不确定这是否有帮助?

      对不起.. 它没有.. 1 秒!

      【讨论】:

      • 是的,伙计,它没有。也试过了!哈哈!我想要的是两个坐标,把它们加起来
      • 是的.. 我知道我看错了你的 Q!不确定您是否可以在 1 条语句中使用?
      • 我想刚才有一个frd询问过。可以在这里使用补丁。问turtle [patch-here] 它返回坐标xy
      • @aHaH:如果海龟在一个patch中心,那么它的坐标是整数,和patch的坐标一样。但是如果海龟不在补丁中心,那么它的坐标是不同的
      猜你喜欢
      • 2015-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-02
      • 1970-01-01
      • 2013-10-09
      • 1970-01-01
      相关资源
      最近更新 更多