|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序' A" C" i6 i2 Q* W, E
其中有一段如下; |, N8 A" j! [
ask turtles with [ infected? = true ]
7 L* B7 }4 P3 [我原本以为这句会回传『所有』infected? = true 的 turtle
9 C. o1 X$ p# P) [但看结果似乎不是这样。* R; [. y- M; Y2 Y
" g8 K2 o# n# J
假设所有符合条件的有 5 笔2 N. a$ I V: O& n
有时候回传 1 笔,有时回传 3 笔,是不固定的
6 |& I, O) Z4 [% [回头查语法定义
/ A: b% p7 N! E) ~with & t5 ~0 q, E( K% P! N: _. m
agentset with [reporter]) l Q6 B- w7 T3 N! Z* m3 s6 l
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.- h( Q! L, T! c5 y7 A( s
它只说回传 agents satisfying the given condition8 W1 d1 H1 y2 B- u! ?) O% J3 \" ~' K
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
1 Q4 \2 m4 e2 V5 d8 O) J4 T& @3 W# O2 |
想确定一下& X7 t5 c" k; v
谢谢!. I! f+ ^/ s; c6 @
|
|