|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序) Z7 ?# h* W2 z9 h r7 H$ y: x* |% Z! S. z
其中有一段如下, g: A& d1 `. M4 S. p X
ask turtles with [ infected? = true ] : y/ t7 L; S( u/ g" a
我原本以为这句会回传『所有』infected? = true 的 turtle
4 @- m) E% d [4 l7 ^/ @5 Q2 e但看结果似乎不是这样。0 r0 H+ k5 b) h. E1 q
! A* ]7 y8 _! r) F# Y& a假设所有符合条件的有 5 笔1 h+ h- m1 \2 C/ B! W% U
有时候回传 1 笔,有时回传 3 笔,是不固定的
9 Y% T- d8 G/ R! E! F3 d M回头查语法定义
/ d. g/ Q9 w0 | lwith
; E$ s) _ n- B* ^" Q& p% k/ ]0 |agentset with [reporter]( r" s3 _ O" P/ l
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 a7 j0 o+ z( E: p2 w它只说回传 agents satisfying the given condition
% i, Q5 V/ s' U$ O) W" @7 Y0 s5 A7 _0 t是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
6 n5 \+ p/ q5 A; ?
3 o9 S$ D$ M t8 o( S2 t想确定一下1 E2 N' r* a9 R
谢谢!
8 H3 |% x" o$ E& z, u |
|