|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
2 V/ Q5 B6 \4 @. N其中有一段如下$ i! W$ J( V+ X* c
ask turtles with [ infected? = true ] / s1 C5 j+ t: [6 n2 l" z2 W
我原本以为这句会回传『所有』infected? = true 的 turtle
5 q- Z o2 y1 s( ]但看结果似乎不是这样。
: h9 S! W. _# [1 t' z( b5 ]
) W3 B# i/ Y; g/ U% K假设所有符合条件的有 5 笔5 L$ I& S) v) E! I
有时候回传 1 笔,有时回传 3 笔,是不固定的
. F5 J$ V/ m0 P8 V* f/ J$ Q, U" P回头查语法定义
6 B' F" }; ]* A3 T( v/ X+ Awith 7 k, K* u3 l% |
agentset with [reporter]
' j3 ]3 ]' W3 d, J& y+ D( aTakes 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.: d$ V+ ^3 j% b3 b5 C, j
它只说回传 agents satisfying the given condition
. F- z7 d, ^- `3 y) U% M- c! t. v是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
+ ^% A7 l8 t5 _2 K6 o' `: m
: v5 n, F; I/ v3 s' f想确定一下8 \+ d, e2 i$ a O
谢谢!
. T; X# v1 Y( ^8 X: s |
|