【发布时间】:2014-04-14 11:38:17
【问题描述】:
在我的代码中,我有一个名为 hops 的变量,由品种蚂蚁拥有。
ants-own
[
hops
distance-gone
distance-to-go
target-node
current-node
]
我想为每只蚂蚁绘制跳跃与时间的关系(即,当它需要 1st hop 时,它同样绘制 1 与时间 n 的关系)。这样做时,我应该在同一个图上有 n 条曲线,其中 n 是我的蚂蚁数量)。
我使用以下代码sn-p实现了它,但只得到了一行图。
to do-plot
set-current-plot "Hop Count"
let i 0
ask ants
[
set-current-plot-pen (word who)
set-plot-pen-color i + 15
plot hops
]
end
如果不同的蚂蚁图用不同的颜色绘制会更好。
【问题讨论】: