|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
, I& Y/ n4 E7 L% B H! h" e其中有一段如下
9 T _; O8 B4 P- N0 Z1 E2 ]ask turtles with [ infected? = true ]
9 i' _0 v3 S/ J* R9 [0 ~7 g我原本以为这句会回传『所有』infected? = true 的 turtle
) b' ]6 u2 h' ^6 K但看结果似乎不是这样。
: I- l2 m5 c/ g/ Q, Z
* ~4 R# D' _! \: u- S) t3 H假设所有符合条件的有 5 笔1 y# e' f' L" h; l2 ~
有时候回传 1 笔,有时回传 3 笔,是不固定的+ d4 x! \ V0 B- I
回头查语法定义0 P9 c6 i2 W% n7 Z: P/ ?" _
with 1 i" [- r$ Y w7 s. B
agentset with [reporter]
/ U! S+ V0 V S4 ?3 Q; ~' OTakes 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.
! A9 Q: E, X7 Y; Q( |' X! S它只说回传 agents satisfying the given condition
% ^: y, ?# H- r u5 ?! U7 }是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? " N' v' P$ S7 Y' d% w
: z# w5 u( s" }7 n8 ^想确定一下2 W( f1 h) c% E* q
谢谢!; u8 B( x) ?% O) N% K
|
|