|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序$ e$ C6 R D* T; Z; c, @
其中有一段如下. n( ]! H Q% _' m9 P
ask turtles with [ infected? = true ] , j9 _" S7 B& Q; e
我原本以为这句会回传『所有』infected? = true 的 turtle0 @$ C, M: }, |6 g; k, F
但看结果似乎不是这样。$ k! k, r) i _7 Q
6 X! F/ ~; z3 J) a2 r+ I
假设所有符合条件的有 5 笔
* A; r: r$ ]) X! F; @' B$ |有时候回传 1 笔,有时回传 3 笔,是不固定的
* ^/ C' K) p1 l1 u" z回头查语法定义
6 K* s. R7 |4 Z/ s) Mwith
7 U8 A3 X' u2 Sagentset with [reporter]* N* P: o% T7 o0 @+ {9 `' x" h
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.( c2 O4 {- |5 _- J7 N
它只说回传 agents satisfying the given condition2 s/ v" W' W! M4 p m
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? * E# R+ n% U! Z- }( F/ J
4 C' t6 A' k" [4 V8 _8 V想确定一下
" x/ e. h/ J/ B& j谢谢!- L$ f: ]( h, d- a
|
|