|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序* W3 y h4 K+ Y5 V' F0 x+ S* r! n
其中有一段如下
8 J, y' J: Y) | z. qask turtles with [ infected? = true ]
( O) x/ k5 o* k" H7 C8 h2 y我原本以为这句会回传『所有』infected? = true 的 turtle
* {9 K* z7 f0 {但看结果似乎不是这样。$ C& b% M2 ~8 q$ j6 G
9 B3 |; [7 H0 i Q: F/ o- c p
假设所有符合条件的有 5 笔$ G& D+ y0 j: I N2 O
有时候回传 1 笔,有时回传 3 笔,是不固定的
( t) ]) G0 D+ w+ H9 D# g回头查语法定义% l2 x$ }$ i7 i, U
with 3 x ^* Y5 q5 I
agentset with [reporter]4 T% w* Y4 d/ w! e2 y
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.; V; J f1 B6 e
它只说回传 agents satisfying the given condition
5 I8 Y, G4 x1 E, _$ T! v% H是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
4 i, B7 |$ q0 g. M0 h- F0 }% a8 M# W3 T8 J! P$ v
想确定一下
2 Z0 u9 q8 f- O谢谢!& \- B/ U# u1 ]- Y; h+ u$ I2 y# r
|
|