在一个过程中,我想为每个海龟(代理)启动一个计时器,当它的形状从“shape2”变为“shape1”时,该计时器在 10 个滴答声后到期,形状变回“shape1”。我的程序仅在我点击“开始”时才有效,它仅适用于计数的前 10 个滴答声。之后它不会被调用。我在 GO 块中将此过程名称称为“更改”。
to change
let test one-of breed-here with [ shape = "shape2" ]
if test != nobody and [ ticks ] of test = 10
[ask breed with [ shape = "shape2" ]
[ set shape "shape1" ]
]
end
GO 块语句是:
to Go
ask breed with [ shape = "shape2" ] [ change ]
end