|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
1 _7 E( O5 X, F" ?" u其中有一段如下
; w \* Q. T: H# o/ E: wask turtles with [ infected? = true ]
7 j( l: }6 o n! r我原本以为这句会回传『所有』infected? = true 的 turtle- e! l% H7 R: K. `# W( R4 H8 ?
但看结果似乎不是这样。
, t) j, F- Y0 n# V
+ V; G* ` `. y! z9 @假设所有符合条件的有 5 笔2 V4 V7 ^% l z
有时候回传 1 笔,有时回传 3 笔,是不固定的
m6 u1 O6 ]1 B+ O2 q9 k9 F6 p+ @5 g回头查语法定义
) d! I2 g: t7 [with $ o6 \- g# O( j$ m* p' J4 |
agentset with [reporter]% h7 V8 c% a6 V( @
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.
0 X) g, i$ M4 g2 z6 V) j B它只说回传 agents satisfying the given condition
p: o+ R- [+ G1 p t: w3 }是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 1 T. {4 ^1 D b {) i
1 W& }6 K" d& L
想确定一下" b2 r& ^) N, n2 w
谢谢!9 U7 T! X# A( T, g" v6 Z
|
|