|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
! n3 @- [* F* k' M( r. R8 i其中有一段如下
: }' l$ J+ i7 c0 B6 A6 iask turtles with [ infected? = true ]
* ^/ D g6 `* H* ~4 y: U我原本以为这句会回传『所有』infected? = true 的 turtle
5 P9 t' L( F. ]7 `+ ~% m) Z但看结果似乎不是这样。
6 ?: w8 j) O0 V# w8 ^ h9 y. n; z" n: k M1 @4 ~! P8 q
假设所有符合条件的有 5 笔
7 h+ G8 m* P, B N; w& b. Y4 V有时候回传 1 笔,有时回传 3 笔,是不固定的4 M8 N0 [8 e- q9 M5 [" R
回头查语法定义8 x& Y# C. }# |) I/ l1 I6 y" n8 f+ J# ~
with 0 E+ {7 A+ V$ R4 D0 ~0 o8 W
agentset with [reporter]0 @; D P4 q9 H: v5 l$ J. B
Takes two inputs: on the left, an agentset (usually "turtles" or "patches"). On the right, a boolean reporter. Reports a new agentset containing only those agents that reported true -- in other words, the agents satisfying the given condition.
* w* b* V s4 y# _' L: o( O) O f它只说回传 agents satisfying the given condition
0 j4 _9 I7 M" }! q& j ?0 c是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
' r( l' @3 P& [ z8 Y) ?& X3 E9 v9 T& I% u
想确定一下
+ C5 b. }$ w) H谢谢!
! b( R3 Z+ P7 Y2 y |
|