|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
6 q* F2 f5 m! N- A0 R' P" R其中有一段如下
" K7 m7 v! @1 q7 D( Qask turtles with [ infected? = true ]
# R0 V3 i% Z" G' f) u+ v我原本以为这句会回传『所有』infected? = true 的 turtle9 }( W3 W {8 H; {* B& w
但看结果似乎不是这样。( j+ j B# d8 Y' j7 ]' D) g/ m
4 k3 `# x% X; }假设所有符合条件的有 5 笔0 ?2 r0 B( T: V! y. S
有时候回传 1 笔,有时回传 3 笔,是不固定的
, c4 u" ^9 ^/ _" c0 M+ c; K [. j回头查语法定义
9 B: A9 v @5 O, @. u0 Swith 7 n* w0 I; O6 l3 N9 g" e5 g
agentset with [reporter]# X' u: k! ]- z( b4 i: T
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, n) L. E% |- E0 X* F它只说回传 agents satisfying the given condition
1 _' ~8 e' ^* C' r是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ( o9 C, N5 S1 o7 Q8 [
+ ^' _; s) i# t- M; O& o
想确定一下" b/ ]5 ~- \5 j& R4 w8 ^/ r
谢谢!
, b) T3 \1 z6 }1 r2 V |
|