|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序- @- s: R4 j- s' y4 B( y
其中有一段如下
( s8 x# l# J) m' \: Xask turtles with [ infected? = true ] 9 K X4 w$ u# r- a; T! H
我原本以为这句会回传『所有』infected? = true 的 turtle" n* i) w7 y9 _
但看结果似乎不是这样。
! p7 p' X& _; X9 T; R
: r8 J4 I( U8 A& D* K假设所有符合条件的有 5 笔8 P+ q0 }) @, |
有时候回传 1 笔,有时回传 3 笔,是不固定的
8 m: K4 U6 b; u- U2 A回头查语法定义8 y) l0 x- [" i8 Y% K- m
with ) v ?/ @3 P' i d: u$ ?% w
agentset with [reporter]3 Y8 E; ~8 Z& }1 m 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./ t+ x* @7 p+ g/ h
它只说回传 agents satisfying the given condition
: I& D/ }/ g3 _, f. [( a3 f; w! z是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
) {2 e2 t$ ]2 q% }( J5 [) @+ b8 O& q9 l/ P( ~
想确定一下
# [# g# l s7 v- J, c# p) R% j谢谢!
) t0 j) b) Q! Z! _1 |) b |
|