|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
! Z2 N& v: ^$ C2 O" u- S其中有一段如下
+ N( F! c- D, N3 e2 t) Pask turtles with [ infected? = true ] & h& q5 R, G0 M" C& [
我原本以为这句会回传『所有』infected? = true 的 turtle
5 d- ^. [' b* Y' O% @但看结果似乎不是这样。
7 C7 J9 p1 H5 v7 w/ D% J+ G
; w% z" v& Z. n2 ^/ X5 |假设所有符合条件的有 5 笔
. ?0 n7 J9 \+ {& R有时候回传 1 笔,有时回传 3 笔,是不固定的
, a5 B* O6 J. m4 M* F% w( U回头查语法定义9 h; a/ a1 O- u: M( E7 D+ q
with , }( p l U% ]# V7 H% u3 L( d1 r
agentset with [reporter], V9 g$ ~' E7 ]0 s
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.: Z/ |( w1 u9 c6 N6 ?. _
它只说回传 agents satisfying the given condition
& B \, c$ l# I' x' O/ k7 W是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? j& ^1 U' R# k0 q: I
4 a9 f z* P8 d想确定一下
% N8 }/ j9 Q) _6 M4 P谢谢!3 Q3 [; i6 g: {2 S5 H
|
|