|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
& }$ Z5 F& w3 L0 o6 q其中有一段如下# ^8 K7 A1 h" _! M% c5 S& w, Y m
ask turtles with [ infected? = true ]
4 a- j7 {4 f5 G& |8 j1 `1 m我原本以为这句会回传『所有』infected? = true 的 turtle- ?" v$ S# P6 t7 Y
但看结果似乎不是这样。1 t E1 O- }; Y* x* |/ |
% L- d+ m4 p+ J C9 A
假设所有符合条件的有 5 笔
3 G& i8 R9 f. ~1 o; K2 A有时候回传 1 笔,有时回传 3 笔,是不固定的
: x" O) t) }$ X7 U1 @+ N+ L回头查语法定义
% D3 C$ s) |4 rwith
9 X/ c- U1 k0 i% k0 T) X7 k. Yagentset with [reporter]9 ?+ s) H% S4 q1 C
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.. N) Z, @3 S' B5 o4 o" D- z( E
它只说回传 agents satisfying the given condition
$ F- r. O+ R2 e* \- D, s: B是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
/ Q1 }. Z) _' r9 Q# X5 G0 l0 {: T, o
想确定一下& u! N. Z$ ^ ?) e, k w- A9 w) l9 s
谢谢!2 h' @2 w+ G9 @
|
|