|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序$ ]4 q/ b" t8 v4 B; u$ T( N
其中有一段如下
+ D5 @! S$ V4 F# d0 y! bask turtles with [ infected? = true ] . V2 B2 _( I& Y3 r. p3 m
我原本以为这句会回传『所有』infected? = true 的 turtle5 G3 Z% P* D+ ]! D
但看结果似乎不是这样。
4 w0 ]3 G: t# g/ U \. Z) S
! m+ X X/ ]8 v3 Z$ Q/ f4 X假设所有符合条件的有 5 笔+ u) R; m w m: A( s. w+ Q+ N
有时候回传 1 笔,有时回传 3 笔,是不固定的
9 B+ B- V, p( \7 i F1 Q' d4 W2 |回头查语法定义
* S' u& z/ F$ u v" i. bwith ' u( R5 F. J' T0 N [
agentset with [reporter]* k# k* x" `6 ?' d! J
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., Y0 A$ F5 Y) n" i. z! r: L7 T
它只说回传 agents satisfying the given condition
4 U2 T: l- i" z1 S$ c r是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? " y# l7 f, V/ ~2 l
3 Y- T8 r# g$ }' M) D T
想确定一下9 B6 n4 Z) q+ S' ]) O2 z
谢谢!+ C: L0 U4 x G6 d/ } J9 ?
|
|