|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序7 {* b, c1 `! k9 B1 M1 P
其中有一段如下
6 P$ S' w5 m, B7 jask turtles with [ infected? = true ]
- f+ ?# [4 h# n- H) E- Y0 a2 ~我原本以为这句会回传『所有』infected? = true 的 turtle, [- F! u; d8 P c
但看结果似乎不是这样。( _9 c) ^. T+ e+ o4 p0 K. [
7 g2 t, U0 ^9 f
假设所有符合条件的有 5 笔
/ {. A5 i+ n7 c' p5 l有时候回传 1 笔,有时回传 3 笔,是不固定的) x+ t# i, h2 g( f: K! o7 K
回头查语法定义
& ^# R+ ~1 Q" Ywith
$ J: u+ ~" o6 n& \2 t5 {4 {, q9 d0 Fagentset with [reporter]; ?5 S6 _; t7 U1 G1 X8 F8 \$ w
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 c. A- C/ d3 i; L# m2 D' Y
它只说回传 agents satisfying the given condition
m! h& ^* |: W3 {7 q$ `( R1 O3 d是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
: J' q2 ]9 m4 s$ w3 u. d
; N2 Q3 W- D7 p) q% B) e想确定一下$ G3 s; f3 ^( q% J; ^" t: n
谢谢!# }! c0 X! G, r8 v) o! ]9 e
|
|