|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
4 V' L( @: r$ O. F其中有一段如下
3 \$ T. |7 [+ t! \1 p/ qask turtles with [ infected? = true ]
6 g6 i5 B# a% _, S$ V7 m9 k我原本以为这句会回传『所有』infected? = true 的 turtle& P7 z8 k- v' h/ N5 W0 _3 L
但看结果似乎不是这样。5 |0 |) I$ N5 h9 ]. N# i4 w
# E1 A: O$ f8 w& i, j* H
假设所有符合条件的有 5 笔" p. E3 M2 t" P/ p) b- e0 y! M
有时候回传 1 笔,有时回传 3 笔,是不固定的9 y" ]. a$ D7 y* _& E1 g e; J
回头查语法定义
: }% b# Q4 E. mwith 2 |$ n7 R$ O+ h+ G/ [* U4 h5 m" o C
agentset with [reporter]) U& m- [1 R9 L
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.
2 h0 o. L* @' A7 e* @/ F5 X* ^+ F它只说回传 agents satisfying the given condition
# g1 F' A5 b$ z) G是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
1 T7 N' ~2 x1 F
, ^4 M/ X7 l! c( u0 t+ @6 f8 g想确定一下! w( \. ~8 j# c
谢谢!
D8 g0 D7 p+ c6 [; e7 W |
|