|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序; a; p, _! x" i8 [* v+ W) V
其中有一段如下
+ n1 h: |" R) x( `& c {ask turtles with [ infected? = true ] " U0 f3 V: y6 U( G% a
我原本以为这句会回传『所有』infected? = true 的 turtle+ }, ]0 p+ `: c/ K
但看结果似乎不是这样。- z' F M: S( S5 L
; @/ q( u1 ?0 p假设所有符合条件的有 5 笔* `( y3 y+ V/ @* _+ I# v8 c
有时候回传 1 笔,有时回传 3 笔,是不固定的! P4 S# t5 |9 i) @3 v ^
回头查语法定义
6 X# U* `$ g/ J7 `% z ewith
& e3 Y1 q9 U$ n0 ]5 V0 lagentset with [reporter]6 J/ d) d ?( U3 U" |
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./ z. i1 p4 g, g' h* k
它只说回传 agents satisfying the given condition% e$ B3 b% j2 f* s- |* V
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
4 ?# [8 S7 W# N0 _/ `1 I
! v3 U0 g3 X) M: R! I) b' L想确定一下, q U& ~* x2 V" E' Q; y
谢谢!
0 o$ c0 r' y8 L( n: h |
|