|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
) s S3 s8 }+ i+ |" \" u其中有一段如下$ z+ q5 i" X+ r
ask turtles with [ infected? = true ] ( D5 ~ \8 ]+ ^# |+ A6 g1 i; G: }4 x
我原本以为这句会回传『所有』infected? = true 的 turtle
4 S. f P! N7 D$ t: W0 B: k4 A但看结果似乎不是这样。 W& B. G! U% q; o! I9 x; |4 d
2 I! q5 J9 r6 ~# x
假设所有符合条件的有 5 笔
" o5 W( _6 y, |* j有时候回传 1 笔,有时回传 3 笔,是不固定的
9 p2 k% B S- {7 D回头查语法定义 m+ `9 p9 K5 Y$ {7 F
with
% ]: o/ m# Y7 }' V) d5 Xagentset with [reporter]
% l% a7 _) i( @6 |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.
2 z- V: h" E7 q8 `它只说回传 agents satisfying the given condition# D2 G: O0 ^( T( ^, S
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
% R: [* K8 e& X6 X j/ [9 H# V4 Z2 g1 j& v, t% X. [. K
想确定一下* ?7 {& r. c( G, p
谢谢!. e: k* g: _5 i' Y! v$ M
|
|