|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序9 q( |' A# B- O4 \4 a9 j6 U4 R0 G3 |
其中有一段如下
- D5 F6 \8 L% z% o6 R* @ask turtles with [ infected? = true ]
8 F3 ]; v: O' E$ d5 X1 I- O5 S/ p% ?7 G我原本以为这句会回传『所有』infected? = true 的 turtle
5 S% V0 E/ a& b4 p; ^$ d但看结果似乎不是这样。
% y" J. G5 U7 Q5 n5 e5 ]/ z$ E/ ^$ A0 r1 E: d1 ?* l u
假设所有符合条件的有 5 笔: R1 R* b0 m, X+ v# P
有时候回传 1 笔,有时回传 3 笔,是不固定的
|, k: F! h( ^, C5 k3 D( ?7 e回头查语法定义0 h1 x9 j) Y, H3 k8 U9 w }% \
with
& Q" p# }( W: aagentset with [reporter]
; }, T' O# S$ H! yTakes 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.( d6 M4 s) u) E" V- l- u
它只说回传 agents satisfying the given condition' \4 R% c+ K# q- Y
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
. {+ ^1 A+ Q2 b( e! n i! I9 k2 e. \4 |! O. h1 N
想确定一下
. J. K8 \/ u; W; o, S8 _" B谢谢!
" {* @' L6 l/ M2 z1 V `: @8 n+ ] |
|