|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序$ ?/ e5 t8 r! P0 \3 p' c8 K r
其中有一段如下
% z/ B5 ^+ k+ t! ?9 K5 Pask turtles with [ infected? = true ]
! W$ X4 j+ T- U: D$ l; s" ^我原本以为这句会回传『所有』infected? = true 的 turtle( r' d: T7 M2 x# e
但看结果似乎不是这样。
: [+ ~! q; V N) r4 t9 C3 O4 [) N
假设所有符合条件的有 5 笔" ~! h8 P) j, R# r
有时候回传 1 笔,有时回传 3 笔,是不固定的2 H8 k- Q% X' S7 X. w% ]
回头查语法定义1 H& e" P" k- ]! g
with
/ T; C1 k1 L# G' \& d$ l4 ?; z, }" `agentset with [reporter]
- X L, ]& `- T! G2 w5 k2 P4 @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.
4 T) G0 ~6 I( e0 O" h1 q$ Q+ }0 u% G它只说回传 agents satisfying the given condition" Y; J2 h# c0 N; p- y) O4 o* {
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? D5 X& S+ r) P% \% {8 U
) q' C i: @2 V1 E7 Z
想确定一下5 @# w' @, b' |9 l" T
谢谢!
8 N1 s& ^& L6 {8 D( F |
|