Netlogo 根据其他海龟颜色孵化指定颜色的海龟
我想在两种不同颜色的海龟重叠后孵化一只海龟Netlogo 根据其他海龟颜色孵化指定颜色的海龟,netlogo,Netlogo,我想在两种不同颜色的海龟重叠后孵化一只海龟 to interact if any? other turtles-here [ birth ] ;detect interaction end to birth ask turtles [ hatch random 5 [ fd 1 ] ] end 我想孵化出一只海龟,它的颜色是两个相互作用的母海龟的平均颜色 差不多 to birth ask turtles
to interact
if any? other turtles-here
[
birth
]
;detect interaction
end
to birth
ask turtles
[
hatch random 5 [ fd 1 ]
]
end
我想孵化出一只海龟,它的颜色是两个相互作用的母海龟的平均颜色
差不多
to birth
ask turtles
[ hatch random 5
[ let color be sum of previous turtles color sum / 2
fd 1 ] ]
end
关于我可能对netlogo语法产生误解的任何提示都值得一提。这可能不是你想要的,但是如果父母是他们分娩时唯一在该补丁上的人,那么这个区块应该会起到作用
to birth
let Q mean [color] of turtles-here
ask one-of turtles-here
[hatch random 5
[
set color Q
fd 1
]
]
end
我不确定你是否需要让后代成为自己的品种,告诉他们改变颜色和移动,或者这是否有效。。。如果这不起作用,那么:
breed[offsprings offspring]
breed[parents parent]
to birth
let Q mean [color] of parents-here
ask one-of parents-here
[hatch-offsprings random 5 ]
ask offsprings-here
[
set color Q
fd 1
]
end