|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序6 U2 c: h3 g( t8 I7 S) \
其中有一段如下/ T( ?6 G* q- u! x6 P/ a2 u# x
ask turtles with [ infected? = true ]
) q$ J$ {7 F' [' E我原本以为这句会回传『所有』infected? = true 的 turtle
7 g. e8 N, ~1 E) T5 R+ e但看结果似乎不是这样。
& C' Q- X/ q9 r. P/ p r
7 d8 u6 v+ U& B* L# J假设所有符合条件的有 5 笔; x! [* [* u( r u1 ?& h
有时候回传 1 笔,有时回传 3 笔,是不固定的: x, _& m3 z( o! r4 R8 w
回头查语法定义+ _6 Q4 q, [# h, N, T
with 0 n( N2 s& {, C9 f* [3 u2 |# i
agentset with [reporter]5 D8 W2 b$ M( s5 F9 E7 ]8 j0 |- 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.. C" g& f- r. ]$ {+ I
它只说回传 agents satisfying the given condition
1 e2 a0 T' v8 @) C u) c; _& i) U+ M8 O是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
- {. L# n2 E3 j5 Y: L8 t7 Y+ J6 A- w+ q, I; O
想确定一下
8 S; Z& H/ p8 E \% ~7 y谢谢! Y" x- q/ y r' L3 F6 B
|
|