|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
0 @+ ?3 I$ c" ^5 a5 |其中有一段如下
6 m5 L3 f$ k3 z+ C: g) N: ?ask turtles with [ infected? = true ]
0 d! f+ w7 ^) U7 S! l我原本以为这句会回传『所有』infected? = true 的 turtle: h' T7 R a1 I7 T. I8 i, O
但看结果似乎不是这样。1 ?" h+ C. v' U& A
/ u' B {7 ]! ~2 b- m
假设所有符合条件的有 5 笔/ p) W* i7 H, ]2 [. W
有时候回传 1 笔,有时回传 3 笔,是不固定的% k0 V- r# i5 H) e
回头查语法定义
/ t/ I1 N. \: F }- O! a; lwith
/ t( n R" z' F5 J! M. l: ^7 v2 Lagentset with [reporter]' C: n. c) ^% K! 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.3 ?& K( r9 Q) x ?3 ~# U
它只说回传 agents satisfying the given condition3 p6 D9 l/ z: @4 {: ]& W1 u
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
5 T6 t& z: ?7 D0 S2 p
, w+ ?3 E% v" W想确定一下
# j# m! Q9 ^# A谢谢!
+ r+ R( J0 r7 P$ s |
|