|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序$ p! Y, H" V" q/ s+ B
其中有一段如下
: @& Q9 W4 m2 a0 aask turtles with [ infected? = true ] K% s. r- a- D" E
我原本以为这句会回传『所有』infected? = true 的 turtle h! K5 [" j6 B! S3 z( L
但看结果似乎不是这样。; o& d% U, F( }0 N% h6 c
) Q( `0 F% s o2 G: B3 D假设所有符合条件的有 5 笔/ y8 [7 v! A D
有时候回传 1 笔,有时回传 3 笔,是不固定的0 [/ b) h+ j- B$ U; u6 K
回头查语法定义
4 O" ^+ v0 R2 l1 C b4 _! [with
" ~0 W7 B$ a5 ^4 {7 |# M% aagentset with [reporter]
7 h3 u1 ~$ m6 g2 u/ u" M& Y0 JTakes 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.0 s$ ^. x7 Q5 J: @' f- D- f" Z$ d
它只说回传 agents satisfying the given condition
3 D4 H8 M9 z9 [: {是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 1 s) t" \1 j. }3 W8 E
6 }- c" t, x6 ?/ E5 l0 Z& @& ]
想确定一下. W1 a( b! f* Q! i4 ~
谢谢!, I: D6 B' w6 Q* J
|
|