将死海龟的数据保存到CSV网络徽标中



我正在使用NetLogo创建一个模拟模型,模拟蜜蜂访问花朵并为它们授粉。我需要了解遗传多样性。因此,为了知道花粉来自的可能斑块,我正在记录访问的每朵花的位置。这些数据被保存为变量,然后我希望当为花授粉时(在储存了足够的花粉后访问补丁(,它会将该列表提供给补丁。虽然它不允许我这样做,因为访问的花列表是一个变量。有什么办法吗?

patches-own [
scent
fertilisation_list
]
turtles-own [
pollen
energy
xy_list
]
to pollenate
ask turtles [
if (pollen > pollen-required-to-fertalise) and ((pcolor = yellow) or (pcolor = blue))
[
set pcolor white
set pollen pollen - pollen-required-to-fertalise
ask patches [ 
set fertilisation_list xy_list
]
]
]
end
to record-patch
ask turtles [
if ((pcolor = yellow) or (pcolor = white) or (pcolor = blue)) [
set xy_list fput patch-here xy_list
]
]
end

to setup-patches
ask patches[
if random 100 < number-of-flowers [ set pcolor yellow]
]
ask patches [
if ( pcolor = yellow )
[ set scent 50
]
]
ask patches [
set fertilisation_list (list 0 0)
]
end
to setup-bees
create-turtles number-of-bees
ask turtles [ setxy 0 0 ]
ask turtles [ set color red]
ask turtles [
set xy_list (list 0 0)
]
end

上面的代码是存储所说的列表时的大部分相关信息。

我收到错误 ' 您不能在补丁上下文中使用xy_list bexause xy_list 只是'

有没有办法解决这个问题?

有一种方法,of.

ask patches [ 
set fertilisation_list [xy_list] of myself
]

由于xy_list属于,但ask将您置于补丁上下文中,因此您需要告诉补丁要复制谁xy_list。myself指的是询问的代理人,在这种情况下是。 但是你真的想问所有的补丁,还是只问蜜蜂坐着的单个补丁? 如果是后者,你应该问patch-here.

最新更新