|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序1 d% A5 @/ V8 I w9 W9 V
其中有一段如下
# }" p) E! m9 _ask turtles with [ infected? = true ] 3 K' y) h2 h& K# @ C4 B" G1 Y
我原本以为这句会回传『所有』infected? = true 的 turtle
0 X |3 c$ i' S4 l1 \! b但看结果似乎不是这样。 r( W9 U6 p5 v; [2 H
; b( s. W8 d. `
假设所有符合条件的有 5 笔- h" I, n1 m2 I+ o
有时候回传 1 笔,有时回传 3 笔,是不固定的
( Q3 F. G( A9 |( R4 N* y回头查语法定义
& P' ^7 |) V+ k/ nwith 9 w1 e5 R( {6 O5 w
agentset with [reporter]; [! k8 ^. P" N# 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.
/ ^# `! ~4 m& e6 C& e/ Y8 P+ }2 \& b它只说回传 agents satisfying the given condition
! Q% E, x C- K& H" I, L# ` V& D是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 5 K, h% w' w; j0 ?
: S, I* f9 r- E' U0 |, Y {想确定一下
. ?/ c# d) `8 T/ {- g1 E0 X谢谢!3 x Y9 J7 S5 X/ W
|
|