|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序! Q6 Y" |$ z: P" J/ }. S& ^; |
其中有一段如下
+ R0 F. _+ @. L4 n$ Zask turtles with [ infected? = true ] / d" g3 Q+ i! T @: `- H8 p" p
我原本以为这句会回传『所有』infected? = true 的 turtle" J5 ^1 m" N# U4 @+ I; T9 n
但看结果似乎不是这样。
) t7 ~) b6 y! m$ `) \ }. y
4 V) p% z L0 F# W# v5 D, W假设所有符合条件的有 5 笔
& K8 v! v, q5 }! H$ R, i. L有时候回传 1 笔,有时回传 3 笔,是不固定的) F7 _8 o- c5 h( l. p
回头查语法定义
) @8 c! E1 n y) J2 swith 7 X: v1 o) @) R6 D
agentset with [reporter]
1 ?: V0 T5 ^$ s ?! fTakes 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.
/ e: m! y& A& Q5 q' p& |它只说回传 agents satisfying the given condition+ z9 r+ y1 d Y
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
. G) k# T6 k& @0 j7 R, x; R4 y
3 p7 x- B* @: e想确定一下& ?5 K: _; s A/ X- M) b3 F
谢谢!
0 h1 S6 G+ z* P+ i- d% X. I |
|