|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序+ y; I" n( S/ ^* A% B# B
其中有一段如下
7 u5 i& r$ R" h# H pask turtles with [ infected? = true ] 3 K# C6 }0 s; g# t; ^4 G: v
我原本以为这句会回传『所有』infected? = true 的 turtle5 B8 @) z8 M2 b* A
但看结果似乎不是这样。5 x2 m- }, m# d! `- ]
/ b9 k, k7 Z' V2 u
假设所有符合条件的有 5 笔
, ]% X" ?- K# B2 d有时候回传 1 笔,有时回传 3 笔,是不固定的; b) l+ t$ e/ w$ \3 ~( [
回头查语法定义
" C7 t( ?2 B! f0 ewith 2 _: s: r' K) Y0 p
agentset with [reporter]1 y& K( O5 D: q; S; K( I' |
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.
8 p& c- P- `/ @" B; X6 p$ [! G+ P它只说回传 agents satisfying the given condition
h; S- ~( t3 c* j; s是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 3 G& b5 g3 {8 N+ t( k6 e. ?1 C
: R& p4 C: w9 ~6 }2 t. c想确定一下) T. b( t/ Y( o4 s$ U. S" @
谢谢!
+ B, O8 r- `- u# a4 _ |
|