|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序) o4 r3 |' b5 p" z; }% W( f
其中有一段如下* P9 T$ ~$ |" i) L" ?. M
ask turtles with [ infected? = true ]
1 `5 F0 g7 d: C: A我原本以为这句会回传『所有』infected? = true 的 turtle
# k4 d) t: Y& ?! h1 O6 X$ e F$ c但看结果似乎不是这样。$ X0 y; y& N+ T9 ~
" g0 z. a& C2 n! S; D5 e假设所有符合条件的有 5 笔
$ r; ~/ h7 \: M9 Q2 F有时候回传 1 笔,有时回传 3 笔,是不固定的
( u# K2 L- B. v9 o回头查语法定义
; J5 d$ `5 p: c4 y$ d+ D9 gwith
. y; B* Z2 h; xagentset with [reporter]9 T9 l I% n5 V5 {
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.- s9 ?! m) _" \. k$ }% Q. b9 `
它只说回传 agents satisfying the given condition
4 x3 ^; e5 u$ P2 C; d; v7 x, k& f是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 4 b! x. `( ]- i; l& B
/ X6 H: x. a; { ^% U% Y6 V, X
想确定一下
! B; ?) S+ ~" m4 q谢谢!3 q" ~5 Z$ p0 L) f
|
|