|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序5 _' ]$ L% R6 f* |5 V
其中有一段如下
9 S* J& B2 s" S {! @ask turtles with [ infected? = true ]
9 `$ l4 n& R2 e B5 a9 k, M5 W9 K我原本以为这句会回传『所有』infected? = true 的 turtle( u0 I) f- P) J' n$ {
但看结果似乎不是这样。) b! L5 H7 v# f& w, C9 ?
; c% y. H U" G3 K. ]( p9 U; C假设所有符合条件的有 5 笔
3 _% Y+ g+ b* \4 G+ K% Y有时候回传 1 笔,有时回传 3 笔,是不固定的
5 w; \& ?0 y; F$ a1 T5 O# _回头查语法定义/ Y+ C, b- M2 O# a0 v
with
! e1 Q9 V& D9 |& r6 A3 b1 c( Aagentset with [reporter]
! F7 ^+ |' T0 B8 Y' t% wTakes 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.
: D5 o7 k: m. w: b$ _1 |它只说回传 agents satisfying the given condition
3 _6 z9 X+ E7 O是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ! ?% t" E+ Z8 E/ J/ x9 Y& B/ ^
& j6 K; B0 ]* f. H ^想确定一下
* O2 o6 C7 p: a# S0 U+ o, g谢谢!
8 g7 x$ T- a( Q, x |
|