|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序 S1 ~9 C# r) D1 k
其中有一段如下
2 B6 X8 U4 i& b$ b, Y2 t& j; lask turtles with [ infected? = true ]
0 U6 t8 G' O4 K* X7 e8 {! e+ T我原本以为这句会回传『所有』infected? = true 的 turtle6 m: U- e, E" v7 z% _' i5 |
但看结果似乎不是这样。" I1 L! x9 q4 d, O
) r: O" p% N1 w* }
假设所有符合条件的有 5 笔
& m9 u! C' I9 T4 ^& Q" ?# B有时候回传 1 笔,有时回传 3 笔,是不固定的1 A& R& f+ G* M8 p
回头查语法定义
! p/ A Y' f( u9 T+ W( hwith
$ A& ?% y0 J) s" u/ p% }agentset with [reporter]
6 `0 C% X, K8 `; D, U1 U* bTakes 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.8 k3 P' a3 n% P) V" S
它只说回传 agents satisfying the given condition# B( A, H% M2 U4 d( f
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ; V% [7 L/ l1 a
1 V7 j& T% e1 p想确定一下
! g$ I$ y: T" a$ l% E# e谢谢!
0 m+ N8 u" r8 j5 a |
|