NetLogo:移动 turtle 直到它在 1 tick 内找到最后的补丁?

NetLogo: moving turtle until it finds the final patch in 1 tick?

我想让我的乌龟游荡到它的 energy< [totalattract] of patch-here。这里的代码工作正常:

to move-turtles
  ifelse ([totalattract] of patch-here < energy)
  [ rt random 90 lt random 90
    jump random 3
  ]
  [move-to max-one-of patches in-radius 3 [totalattract]
    ]
  if energy = 0 [die]
end

但是,我想让它在 1 个刻度内徘徊 - 从徘徊(跳跃)开始到跳跃结束(当它的 energy < [totalattract] patch-here) move-it 以斑点半径 X 中的最高 [totalattract] 值进行修补。我试图实现 while 条件或 repeat,但是对于 repeat 我需要特定数量的移动,这取决于乌龟的 energy 和补丁的 [totalattract]。我该怎么处理?我将非常感谢每一个帮助或建议!!

如果您希望 所有 海龟在 1 个刻度内完成它们的程序,您需要将 tick 语句放入您的 go 程序中。像这样:

to go
   ask turtles [move-turtles]
   ;Some other code here...
   tick
end

如果您只希望一只乌龟在 1 个刻度内执行其程序,您需要将 tick 语句放在 move-tutle 程序中。像这样:

to move-turtles
  ifelse ([totalattract] of patch-here < energy)
  [ rt random 90 lt random 90
    jump random 3
  ]
  [move-to max-one-of patches in-radius 3 [totalattract]
    ]
  if energy = 0 [die]
  tick 
end