有没有办法在模拟过程中产生海龟,即使它们死了。在我的模拟中,鱼正在吃浮游生物,所以如果它们遇到浮游生物,浮游生物就会死亡/被吃掉。然而,当一条鱼不能再吃浮游生物时,它就会死亡,因为它不再通过食用浮游生物来获取能量。所以当所有的鱼都死了,浮游生物应该会回来;由于迁移等,并迅速增长。我不确定如何实施?create 功能在这里不起作用,仅在设置中起作用。
to plankton-reproduce
if random-float 100 < reproduce-plankton [
set energy (energy / 2)
hatch 1 [setxy random-xcor random-ycor]
]
if count plankton < 10 [
create-plankton 20
setxy random-xcor random-ycor
]
错误:你不能在海龟上下文中使用 create-plankton,因为 create-plankton 只是观察者