|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序2 q. }: j( C) w' ^- Z, _5 I/ b/ W
其中有一段如下
% m) J+ [/ c5 @& q8 u4 _ ]: V' [+ gask turtles with [ infected? = true ]
9 u& g. t+ N- H$ Q' R- t5 C, W我原本以为这句会回传『所有』infected? = true 的 turtle
! @- |8 Z+ e9 k0 x& A: j但看结果似乎不是这样。
% g4 D8 {- w/ z4 I( a1 l1 h- G. T& c7 [4 P I" N" V
假设所有符合条件的有 5 笔
7 E8 w! Y$ R8 [( u/ O; @有时候回传 1 笔,有时回传 3 笔,是不固定的- q8 O( s7 L& u8 N5 I/ e
回头查语法定义4 s! L: V9 ]5 B1 O0 U( R$ _
with
9 a9 M4 O5 c9 a& M* ragentset with [reporter]
3 I& E- l' j4 g3 I; U; ` u7 aTakes 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.
, z( |8 Y" I8 T1 I: H它只说回传 agents satisfying the given condition1 i$ w1 |; U+ V. F
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 0 L* a4 `: Z) b
+ f9 s7 t- C0 J, d; f0 J: q
想确定一下8 S+ ], L) a5 d" m. {
谢谢!
G- Z& I3 E. n( X4 p3 u R' M |
|