|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
9 |; C2 H1 Q' G$ ?. b1 B+ f9 F其中有一段如下
0 d! p$ j6 a- L; O( dask turtles with [ infected? = true ]
' b& a9 ^' R! u# `! w1 `8 S& Z我原本以为这句会回传『所有』infected? = true 的 turtle! U# x# H. G+ @# t
但看结果似乎不是这样。
8 K8 o3 E# Q+ l/ Y$ S$ _8 U7 t/ K2 |3 X
假设所有符合条件的有 5 笔
! t3 d1 w" X& x! W. \% l0 I有时候回传 1 笔,有时回传 3 笔,是不固定的$ J( R9 A) q5 t$ V7 R
回头查语法定义
! F9 Y: }9 x: N Y* D. L+ ywith
* L7 Q) l8 n. \$ i$ o/ U* v' nagentset with [reporter]0 l+ K- d$ N+ I+ B, h/ J
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.1 o# T/ `. e$ n; r! q. I
它只说回传 agents satisfying the given condition
5 ?" c& Y7 e7 X$ u; Z0 |* t1 H是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? R& x% l) y) F- v3 b
& ], k% Q% u& F
想确定一下
5 v9 g9 n: O9 Y& J/ T谢谢!
$ W3 L& i3 t$ ^ |
|