|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
. G- J" w4 B+ Y& ?其中有一段如下5 Y* Q9 S; K6 ]# X1 M/ @
ask turtles with [ infected? = true ]
; W8 c7 K! z" l) h8 @我原本以为这句会回传『所有』infected? = true 的 turtle9 A9 s6 d- b1 _5 o9 u) [
但看结果似乎不是这样。
* R. A& ]5 X4 J) j* _% G* J7 q
8 C: w( D& A9 \' q假设所有符合条件的有 5 笔
- C" X: c$ ~* a有时候回传 1 笔,有时回传 3 笔,是不固定的
, e, b6 y. j6 d- L! M# w* s( c8 _回头查语法定义8 M9 k/ Y& p$ R {8 M
with
& \" n. w4 ^$ l0 a$ ^0 o$ [% magentset with [reporter]2 T a7 x3 A' ?# r P7 d3 Y# [" O
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.
" v9 B9 L0 g% ]4 ~0 }2 ^+ d. Q它只说回传 agents satisfying the given condition
2 {* z3 H' [; f5 O3 t C- H2 v8 Z! |是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ' g& f7 ^! ^! ?4 M% l
0 P2 P* k0 |/ f2 ]8 M! l
想确定一下. t( M: U g4 q. C
谢谢!% L+ ?8 L; [2 ~+ H2 h, b" R2 f
|
|