|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
+ H) X5 q& t, q4 R其中有一段如下
# s* ~& u( T& G$ O, Dask turtles with [ infected? = true ] & Q/ \9 E0 o7 O+ @- Z. ?
我原本以为这句会回传『所有』infected? = true 的 turtle2 d& G/ K* ~' \4 N" h
但看结果似乎不是这样。 |) s+ R, v% ]$ g4 C
9 ?* J8 X& I& ]5 k假设所有符合条件的有 5 笔
" I0 P" N- A5 {, P有时候回传 1 笔,有时回传 3 笔,是不固定的 B5 Z; b9 F: d8 d; d
回头查语法定义
* X9 w( T* { j' O, Y0 owith : y" P0 R: G/ b2 E/ a
agentset with [reporter]
9 ~* z$ w: C3 l/ JTakes 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.
" Q9 Q: q. k9 [! k/ ~1 B它只说回传 agents satisfying the given condition0 I8 v6 D/ _4 d8 r& u
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
% G: J! E1 E8 K" e! z% K" E) p; C
: V c! }: M6 _' }0 H8 l想确定一下3 ]- n$ |3 E9 x3 `' C0 m1 Q
谢谢!- k* T6 m# b* T. h
|
|