|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
& ]; Y$ x: Z% @* {4 I. Z其中有一段如下5 ]% n' k% Y( M* c6 u
ask turtles with [ infected? = true ] ' X" p% l) ~; ^* w$ [
我原本以为这句会回传『所有』infected? = true 的 turtle l5 p" U3 C+ k+ @+ o5 X
但看结果似乎不是这样。
7 T; L# B5 e! Z: N& D" [9 V1 s
假设所有符合条件的有 5 笔
- b6 h1 U! ^; L有时候回传 1 笔,有时回传 3 笔,是不固定的# H# b5 _ F O5 t3 S5 [
回头查语法定义
; d( E8 ^, W. L+ O! Iwith x6 d: ~5 f& O% q) ?8 b) N
agentset with [reporter]* r1 k2 }0 ?% l5 V
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.
5 p+ s5 }# Z+ d6 F4 M它只说回传 agents satisfying the given condition
, X" C9 L9 U5 k& o' x1 ?是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
. \' @/ Z" D5 X
6 R- A" t! V3 ^8 C- A9 t1 j) S想确定一下
; @. N: A Y5 O7 b X" N9 D1 `谢谢!/ ^' v; g. z! o( ^0 R: m
|
|