|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序0 Q1 J# t6 H2 k# I5 k
其中有一段如下
9 v9 F \1 e; b+ x( e6 `ask turtles with [ infected? = true ]
, k( S5 z1 ~# [# {' M( y我原本以为这句会回传『所有』infected? = true 的 turtle1 i8 F. q' Y. M* c
但看结果似乎不是这样。1 \3 t# ?3 I* u0 \* C
) G: F! p2 Q( ?* n假设所有符合条件的有 5 笔
, I, j' d( R( x, ^8 A2 O有时候回传 1 笔,有时回传 3 笔,是不固定的
5 s: l3 N/ y: ?/ V* E8 S: X回头查语法定义 n. t9 d+ O" i
with / R, D& W$ Y5 C4 h% M9 ^
agentset with [reporter]
, b3 ]5 P6 p& L$ x9 q* {! @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.# L) E4 @1 [0 i9 n, {
它只说回传 agents satisfying the given condition V( W4 ?# m: N, c* B
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
; N' B) G( ]- J! d1 s3 U9 H0 q3 ~8 O* `) L' M
想确定一下. z3 |7 p" s2 a# K! B
谢谢!2 n% c: X9 L0 g D7 t! T2 M. Z0 L, u& a
|
|