|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
" i( z/ R/ _& I4 H0 u% t5 _其中有一段如下 V" a! \) ^0 F- I1 E. T
ask turtles with [ infected? = true ] 9 k6 a7 k) E& l' _ a
我原本以为这句会回传『所有』infected? = true 的 turtle: X2 G8 K* g! `* h
但看结果似乎不是这样。3 w7 R) \, W3 Q* }" n5 H7 y
- L6 r, s/ W& ~# F/ f( i6 B& m% _9 G假设所有符合条件的有 5 笔) d+ R0 n% C0 W$ V# m
有时候回传 1 笔,有时回传 3 笔,是不固定的8 B, V# P- l: s
回头查语法定义
2 t' h$ z- }+ J# y/ Q2 d; zwith . i, f$ s; R9 |4 L
agentset with [reporter]% Z( B* _8 Y8 o0 [
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.
4 E" n" }: t# A' Z它只说回传 agents satisfying the given condition
# \* {% k3 `: H+ `0 n' k" v8 `6 \是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
2 Y, {: F- i$ @4 g% r3 f
1 L$ |' V' X# S* ~3 ?+ b想确定一下) ]- B) x3 v2 r7 f" B: H* P
谢谢!
) |+ w9 s+ F0 ] n& z/ u C) k3 m. O |
|