|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
5 R$ o0 u- u% H7 _% a9 z# E其中有一段如下" T$ ]5 G& e: C1 n) d7 @# F/ V$ D
ask turtles with [ infected? = true ]
# N5 f+ J: R9 V2 s. X我原本以为这句会回传『所有』infected? = true 的 turtle. J+ I9 Y$ L- M. Y8 q
但看结果似乎不是这样。
& o; ?- {. u" i$ e, `# u2 n8 p
U- Y. K% U1 P1 y3 T4 F假设所有符合条件的有 5 笔1 X3 T7 ]7 K9 K& m; n% C; {4 i- `
有时候回传 1 笔,有时回传 3 笔,是不固定的
; U; V* G) _8 A6 h$ O" Q回头查语法定义
/ _& I1 ?! U4 f! w. @* vwith
( D4 }( o( y2 |5 ^1 j9 ~7 yagentset with [reporter]
8 g9 g" a' {$ sTakes 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.
D* K9 O4 l0 U6 A- f" z+ M它只说回传 agents satisfying the given condition
; P9 J' R- x* B+ D, n4 K6 i- H是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? - Z/ d0 H% f' h6 I' B' N3 E
3 u( k; |: x a: R
想确定一下
: D0 q% C& I) g0 q谢谢!% n, O, T n. m/ z. M8 X# `4 a
|
|