如何让海龟在规定的繁殖季节繁殖一次?
How can I get turtles to breed once during a defined breeding season?
在我的模型中,我有男性和女性。它们可以在每 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
在我的模型中,我有男性和女性。它们可以在每 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