在我的模型中,我有雄性和雌性。它们可以相互繁殖,每365天在特定的蜱虫身上产生后代。
我怎么能让成虫在繁殖后关闭繁殖能力,但在下一个繁殖季节恢复繁殖能力。
ask females [
if age > 0 and age mod 365 = 0 [
reproduce
]
.
.
.
to reproduce
if count mates > 0 [ ; the number of males in a defined radius
hatch fecundity [
set mother myself
set father one-of [mates] of mother
]
一种创建变量的方法,该变量计算自它们上次繁殖以来的天数。然后在每个刻度上递增该变量。一旦雌性成功繁殖,就重置它。类似(未测试(:
females-own [days-since-child]
to go
...
ask females [ set days-since-child days-since-child + 1 ]
ask females with [days-since-child >= 365] [ reproduce ]
tick
end
to reproduce
if any? mates > 0 [ ; the number of males in a defined radius
set days-since-child 0
hatch fecundity [
set mother myself
set father one-of [mates] of mother
]
]
end