我想要计算在路上停下来的乌龟的数量,我想取X坐标信息,并将其设为队列长度。以下是示例程序。
ask turtles with [ not right-end ] ;a flag "right-end" to the red turtle for differentiation to the other blue turtles
[
ask turtles with [ speed = 0 ] ;the speed is 0 means stopped
[
set top max-one-of turtles [who] ;get a turtle with biggest id
set topx [xcor] of top
set L count turtles with [xcor > topx] ; L is the queue length of Little's Law
]
]发布于 2017-07-23 01:45:27
我很难确切地理解你想要做什么,但我认为是这样的:
to-report countRightmost ;global context
let ts (turtles with [speed = 0 and not right-end] )
let top max-one-of turtles [who]
let topx [xcor] of top
report count ts with [xcor > topx]
endhttps://stackoverflow.com/questions/45250194
复制相似问题