|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序3 u/ M7 n% C- U& s, y( g" q
其中有一段如下! E$ U. H3 |6 } G
ask turtles with [ infected? = true ] 2 i! ?3 ^& J2 G
我原本以为这句会回传『所有』infected? = true 的 turtle) e& T$ m, ^- D* ?2 N4 C
但看结果似乎不是这样。% D( [ s8 R4 M: [3 ^# Q
* U6 R7 |7 ~6 e. H" X假设所有符合条件的有 5 笔- N4 z ^4 R! w: r) j8 m
有时候回传 1 笔,有时回传 3 笔,是不固定的
4 S) t. Y2 |: N) C回头查语法定义
2 [9 _/ _. T* n8 D4 W$ Q8 _with
; z/ l3 O( b z1 P9 Gagentset with [reporter]
& e% h6 \4 e2 ~5 U, U4 O9 rTakes 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.1 U3 X. l; [" ^
它只说回传 agents satisfying the given condition0 L' Q1 T, w" f: w0 h& r
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
( m6 E& \/ ]( Q) p9 I- z0 p% |1 K, O! f
想确定一下
/ q6 }" E6 F+ a+ J1 }' ?( N谢谢!
# H2 k$ a+ S- F8 U& r H8 V9 L |
|