【发布时间】:2021-10-03 06:39:23
【问题描述】:
我试图展示森林砍伐与重新造林。为此,我创建了一个滑块来显示正在进行的重新造林和砍伐森林的数量。然而,每次 11 点,整个场景都会被砍伐,我不知道为什么。
patches-own
[reforestar
deforestar]
breed [ potreros potrero ] ; sheep is its own plural, so we use "a-sheep" as the singular
breed [ bordes borde ]
breed [ bosques bosque ]
to setup
clear-all
set-default-shape turtles "frog top"
ask patches
[ifelse pcolor = 44
[ set reforestar tiempo-sin-reforestar ]
[ set reforestar tiempo-sin-reforestar * 0.5];
]
reset-ticks
end
to go
ask patches [ reforestacion ]
ask patches [ deforestacion ]
tick
end
to reforestacion ; patch procedure
; countdown on brown patches: if you reach 0, grow some grass
if pcolor = 35 [
ifelse reforestar <= 0
[ set pcolor 44
set reforestar tiempo-sin-reforestar ]
[ set reforestar reforestar - 1 ]
]
end
to deforestacion
if pcolor = 44 [
ifelse deforestar >= 10
[ set pcolor 35
set deforestar tasa-deforestacion ]
[ set deforestar deforestar + 1 ]
]
end
这个想法是一些随机的棕色(deforestacion)变成黄色(reforestacion),但由于某种原因它只是一次改变了一切。
【问题讨论】:
-
您提供的代码没有重现问题。请分享你的代码版本,这两个版本都是reproducible and minimal。