【发布时间】:2020-12-26 18:42:10
【问题描述】:
招募程序的代码在模型的多次迭代中运行良好,但最近第一只乌龟似乎从食物中反弹并变成橙色,这可能是寻找食物程序的一部分,而不是改变品种和变白。如果乌龟进入/进入食物块区域,它似乎工作顺利,但它们似乎正在接触食物块的边缘,并以某种方式触发寻找食物过程。或者,可能会发生缩写 to go 代码中的品种转换(询问领导者......设置品种觅食者,设置颜色橙色 + 1),但这似乎不太可能。我尝试扩展补丁集以包含似乎触发此更改的边缘补丁,但这不起作用。任何解决此问题的帮助将不胜感激。
to go
ask foragers
[wiggle
fd 1
look-for-food
recruit
reemerge]
ask leaders
[wiggle
fd 1
return-to-nest
if count followers with [color = violet] >= 2 ;; transform leader into forager that has found food
[set breed foragers
set color orange + 1]]
tick
end
to look-for-food ;; forager procedure
if food > 0
[ set color orange + 1 ;; change color to indicate that they have picked up food
set food food - 1 ;; and reduce the food source
facexy nest-x nest-y
uphill-nest-scent
fd 1]
ask foragers with [color = yellow]
[if not any? followers and food-quality <= 0.6
[let choice random 3
(ifelse
choice = 0
[uphill-false-food-scent-a]
choice = 1
[uphill-food]
;;;;;;;;
[uphill-chemical])]]
if food-quality > 0.6 and color = yellow
[uphill-chemical
fd 3]
end
to recruit ;; forager procedure
let potential-leaders foragers-on (patch-set patch -37 -17 patch -36 -17 patch -35 -17 patch -38 -18 patch -37 -18 patch -36 -18 patch -35 -18 patch -34 -18 patch -39 -19 patch -38 -19 patch -37 -19 patch -36 -19 patch -35 -19 patch -34 -19 patch -33 -19 patch -39 -20 patch -38 -20 patch -37 -20 patch -36 -20 patch -35 -20 patch -34 -20 patch -33 -20 patch -39 -21 patch -38 -21 patch -37 -21 patch -36 -21 patch -35 -21 patch -34 -21 patch -33 -21 patch -38 -22 patch -37 -22 patch -36 -22 patch -35 -22 patch -34 -22 patch -37 -23 patch -36 -23 patch -35 -23)
if any? potential-leaders and not any? leaders and food > 0 and count foragers <= 10 ;; checks if any leaders exist
[ ask one-of potential-leaders
[ set breed leaders
set color white]] ;; transforms first forager to find food into the leader
end
```````
【问题讨论】:
-
由于查找食物程序是错误触发的程序(变为橙色),那么原因很可能是请求查找食物程序的程序。据我所知,您尚未提供该代码。
-
刚刚编辑以添加该代码!
标签: netlogo