|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序) ~4 w( ^8 D( C( L( S
其中有一段如下% {2 @" c7 I3 [( D5 D
ask turtles with [ infected? = true ] + e* J' G) t# `% w" r. [+ E
我原本以为这句会回传『所有』infected? = true 的 turtle: a6 k7 w1 e# h3 u2 y& X7 o& j* j5 k& z
但看结果似乎不是这样。
8 c. K& C: C/ |6 z5 Z" B2 B! J$ R
假设所有符合条件的有 5 笔
" g+ C9 W% \ u$ x) G+ |1 [有时候回传 1 笔,有时回传 3 笔,是不固定的$ ^" C& p% }# v1 h2 u
回头查语法定义7 N g' |6 d$ g4 K8 V1 P5 y* Q
with 2 g+ k l, D s' G' F: d
agentset with [reporter]
. Y9 d5 z& q' P! BTakes 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.3 r/ Z1 d1 }8 p& L
它只说回传 agents satisfying the given condition A! k' _3 X% V3 r5 `$ L
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 1 g+ o$ G3 W5 ~; @2 ]" F
5 t) A5 i5 _6 y( H( J
想确定一下 J; `/ G$ ~; e/ Q% i8 o
谢谢!9 j V6 R) r0 ^4 `$ o' i+ x/ o
|
|