|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序( E5 C# f& a1 b7 i M3 {! R
其中有一段如下/ x8 n# [# v ~8 L
ask turtles with [ infected? = true ] 3 j. t' W) i2 x8 _
我原本以为这句会回传『所有』infected? = true 的 turtle8 C% q2 L1 O4 R: W
但看结果似乎不是这样。 g# p0 E/ E5 Z. s. T$ ~
, I/ o u8 y1 ]) d' E7 P2 e假设所有符合条件的有 5 笔
6 |& ? L) M- r) O* f有时候回传 1 笔,有时回传 3 笔,是不固定的
3 Q( X) I0 j, R/ f, ~; v回头查语法定义/ T" m% x K" Y$ k
with
9 N' y* Z3 k0 v& yagentset with [reporter]
4 | h1 d* O0 P4 K- N* ]% _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( O8 z. s+ s }8 ]# t! w/ e7 n% Q它只说回传 agents satisfying the given condition
! M9 \3 q4 G/ a- b是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
" [1 Q# D- O& q3 S% O# `6 N
! X+ `1 T& Q+ m: n+ v% r' [想确定一下
, t2 Z+ s0 e3 C谢谢!2 Z( O8 l0 Z! w4 J2 k H! X- N5 @
|
|