|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序3 F& D. Z |; E7 F
其中有一段如下 s/ ^& L6 A |' {' S
ask turtles with [ infected? = true ]
% @/ g. r% G8 p% Y+ v" i我原本以为这句会回传『所有』infected? = true 的 turtle
% s' p: J$ W' M# k! F但看结果似乎不是这样。
& h/ S: _, \2 i9 b _ P5 ?# R4 [* B
& {: W s3 M+ p" m9 J( H j假设所有符合条件的有 5 笔
0 X# e: ]% C8 r" I9 l有时候回传 1 笔,有时回传 3 笔,是不固定的/ c" D+ ^' v) z$ r8 p
回头查语法定义
6 T5 y) [$ ]( m% T( \with
! z) I" y& M( x: a# L) D2 Aagentset with [reporter]/ o+ N0 g- i0 P3 F! D0 b
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.) X: U$ B/ q, X( J1 ^
它只说回传 agents satisfying the given condition
1 z, U: B( ?8 l$ q9 Q! O是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? C! N" O/ c" S
9 m- `( K* ?; V* x6 y
想确定一下
' w( w& y$ x0 C& o, O6 E谢谢!
# Z# s# r: @/ b! X% V2 \- `9 v( X |
|