|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
- V7 T; m" [: q3 u' k' _2 N5 \其中有一段如下1 q @8 c; ^; t( f3 p' Y/ q
ask turtles with [ infected? = true ]
$ Q7 x+ x3 l( }我原本以为这句会回传『所有』infected? = true 的 turtle
8 R4 k" |9 D R% G, m但看结果似乎不是这样。3 g9 }$ N4 i* x n6 @( S1 m
3 m* e: E/ f8 c. u4 t7 p
假设所有符合条件的有 5 笔
2 a7 H; ]) F3 x, `& l9 q: H3 K; r4 R有时候回传 1 笔,有时回传 3 笔,是不固定的0 g; m8 j( Y; {# K, z' M$ H# k' C
回头查语法定义% F& d9 i9 q' c z
with
5 H1 u8 q4 K- h% \8 b, M: {* tagentset with [reporter]2 u( X$ W: ~: |
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.& l. c" ~! |* R' X
它只说回传 agents satisfying the given condition
2 z* E0 U: J& V& Q是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? - a9 u y/ P0 \0 U" Z6 P1 W
* G4 U* k' _0 T想确定一下* ~; v4 N! t: t1 a& B& C
谢谢!5 K) m6 P6 \ X8 T8 g' m* I
|
|