|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序9 n; z; o/ z& P! D. O" u" g
其中有一段如下
|: L } L: x/ E% S7 q* `ask turtles with [ infected? = true ]
$ ^3 z! v3 D' c* P3 V" ?: K我原本以为这句会回传『所有』infected? = true 的 turtle, R* D( Z2 ~" H+ f/ E
但看结果似乎不是这样。4 Y8 {7 V0 W. w0 g
+ ]9 z# Z1 N% ?: s+ `假设所有符合条件的有 5 笔1 g4 l# M" a$ r/ O1 H: |# I; Z
有时候回传 1 笔,有时回传 3 笔,是不固定的
( a: X% ~" u* I, r; Q# q回头查语法定义# d" K+ Q" ]& l8 k, j2 r; a; u- P; ` a
with
' P- X3 Y4 [7 n7 j3 w! j# c& gagentset with [reporter]1 X8 [4 d" ?* n/ q N9 S! z
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.
i' G/ }. ?4 l% `$ P它只说回传 agents satisfying the given condition4 ~# J, g8 r: Y( Q* _; ~9 t$ B
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
1 o( B) e' f- T6 e M2 X! @
# } ~2 Y, O5 f0 y想确定一下# m9 U/ X' A, s B, j5 {
谢谢!
: L6 f, T- I' r5 x- S- N- }* ? |
|