|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
2 a% D0 w4 j7 [7 v) O9 H5 Q; z其中有一段如下! i7 b* g1 Y! M ^+ p i' S" R
ask turtles with [ infected? = true ]
& Q) Q' a. ~$ C- K6 t我原本以为这句会回传『所有』infected? = true 的 turtle2 ?" t; } r: o9 q5 O
但看结果似乎不是这样。& E+ v" ^, c- Z4 h2 H3 R
/ R0 T H+ H( d. O
假设所有符合条件的有 5 笔
3 O, M, ?2 j7 K8 _7 w有时候回传 1 笔,有时回传 3 笔,是不固定的
, J: A% Q9 ^2 p! K% L( T; j- S0 T回头查语法定义8 A) ?. \3 V% s: h
with
1 O, T9 R. N! Kagentset with [reporter]
$ i. \$ u0 T) z; h5 t; A" BTakes 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.) b, }! ~4 Q" N* J) y' o& w: F
它只说回传 agents satisfying the given condition
5 b6 [* X& L( E5 e" F, A4 d; J是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
/ R! ?' d! c5 Y) ?% Y# l q. G$ z& q& n9 v
想确定一下
5 U4 r5 X" j, ]' W/ D& z- w谢谢!6 J, T/ K" [; P2 e, j
|
|