|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
2 |+ }- R/ S" R" Q' P$ t其中有一段如下/ |6 N7 _" d5 u. V' m$ @
ask turtles with [ infected? = true ]
5 F+ s) Y9 N5 G0 x# _. A7 S! f我原本以为这句会回传『所有』infected? = true 的 turtle
, Y3 P) o' d9 X# R T3 [但看结果似乎不是这样。# k% z0 ]# G4 W* z
5 S9 ~. y( y7 h; g( i5 v
假设所有符合条件的有 5 笔
6 D5 ^1 n5 l6 t5 T7 U( A: O# H有时候回传 1 笔,有时回传 3 笔,是不固定的' P7 P: b* ~7 p, J9 p3 u% M4 p
回头查语法定义& t( U% i% v! E1 f& V+ {. q
with
& v8 l" O1 }. M; B0 Yagentset with [reporter]
g* Y& B5 }! Y% J7 W( JTakes 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.
! B" a' N8 [8 t6 }. G它只说回传 agents satisfying the given condition d4 N$ ^6 l/ c) n' u3 x
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
, O9 a8 W0 h6 @, Z' H" Q" `3 D9 K- j$ _' ~4 n
想确定一下7 Q/ p; z1 e# S1 z- `- |' W3 z8 S
谢谢!: l' _5 r* J$ q* ^ ?) C
|
|