|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
( f/ h, W d9 o- E$ o5 I其中有一段如下
7 K, ?- d& f7 M& yask turtles with [ infected? = true ]
8 Y) i3 P8 D" r& H' z9 e我原本以为这句会回传『所有』infected? = true 的 turtle" ?$ p' ` `" N
但看结果似乎不是这样。' Y$ B' ^( p- e! U( W2 G4 B& H
" x; ~ B q6 K假设所有符合条件的有 5 笔
# l% _1 Y! o- ]! i6 w有时候回传 1 笔,有时回传 3 笔,是不固定的
$ K8 r, ^# N8 h2 X' ]7 j; q7 [, g8 H回头查语法定义
/ p# Y" i. @4 s! q$ hwith , X$ {% \% O* G1 A' v O
agentset with [reporter]) e& `/ H; T$ x8 j9 P
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.1 K2 J2 g4 p3 P
它只说回传 agents satisfying the given condition
5 m8 ?, I* H9 W) P$ N; a/ T* X是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
- l' {9 O0 Z0 `. q1 C. P
6 V7 _+ `8 g6 K' s) U( g7 P想确定一下( i. X1 `+ J: W. a- X _
谢谢!0 x) Q2 W0 F. z! C; R: C( C* S
|
|