|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序$ l3 s7 \. m N- A8 \/ O, Q6 C
其中有一段如下/ `- u. o, A9 ~0 S1 c( B
ask turtles with [ infected? = true ] 2 y* y2 L% S" x2 ]( g; D4 R
我原本以为这句会回传『所有』infected? = true 的 turtle5 B3 {/ q4 r5 z! E4 N
但看结果似乎不是这样。1 i) Q/ i: A9 s- W1 ?4 V
% G3 v/ o+ |% p. c) l" x假设所有符合条件的有 5 笔
4 n( X9 |( M! M* T' o8 _- F/ z- G有时候回传 1 笔,有时回传 3 笔,是不固定的
* b( m" X- o8 u- p2 M5 e, `回头查语法定义1 A- w; X# E. i/ ^8 T+ r! Z" p7 _
with 5 C# d f5 \& Q# t" k: S
agentset with [reporter]
! V3 v% E( g6 o: |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.) V5 G7 I4 k* O6 [! o/ f
它只说回传 agents satisfying the given condition8 p. x* _# C# B
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 5 w. [: ?2 _* O
! u8 l( G( e3 ?. u想确定一下
4 d, b) @8 ]6 {0 T N谢谢!
% _% ?$ v5 ^9 g' O! d |
|