|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
e. ~, x6 v( J2 j( @( G其中有一段如下
8 {9 l0 A4 T, h& _8 ~1 wask turtles with [ infected? = true ]
2 p9 D1 K; b2 Q s" g我原本以为这句会回传『所有』infected? = true 的 turtle2 u* R W1 Y. I/ _" }7 `
但看结果似乎不是这样。8 X3 S0 l5 _6 A1 p
& ~" E& F5 |7 q9 t F* Q2 o' n
假设所有符合条件的有 5 笔# X$ A/ D# Z7 V% c( H& o1 j& O9 X
有时候回传 1 笔,有时回传 3 笔,是不固定的
* u! `5 K) H+ V, B3 _5 Z# W4 J7 ]回头查语法定义
9 l* Z, G( N7 kwith " G3 n; h5 W2 a* i0 ]
agentset with [reporter]* |* u1 a* q- K, h% ^7 }
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.
1 _ p c l6 K0 m, l F9 z& z它只说回传 agents satisfying the given condition
) b4 [5 {& [' [是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ) w5 D. H6 p! ?8 N6 X( ]6 e
0 w8 d9 h7 `$ ^( X* e' r/ }, y想确定一下
/ p0 t% i( `& l! n! J谢谢!' V( H0 z* e- {5 n" }5 Q
|
|