Netlogo地形的创建和传播

时间:2011-03-07 15:55:51

标签: terrain netlogo

我需要一些帮助来设置特定的地形。我有一个200x200补丁的世界,每个补丁的大小为2像素。我要做的是从原点开始建造一座小山,然后将高度均匀地分散到世界的边缘。

原点将在最高海拔附近:999,并且边缘附近的补丁将使海拔高度接近0.从世界的边缘,海拔应该不断增加,直到它到达原点然而,我可以似乎让山丘延伸到世界的边缘 - 中间有一点凹凸,世界其他地方完全平坦。

任何人都可以帮助设置地形并解释如何让海拔高度正确地扩散?

这是我到目前为止的代码:

patches-own [altitude]

to setup

  clear-all
  ask patch 0 0 [set altitude 1.0]

  repeat 100 [diffuse altitude 0.25]  ;; this needs to be changed?

  scale-patches
  color-patches 

end




to scale-patches

  let low [altitude] of min-one-of patches [altitude]  ;; altitude of the lowest patch
  let high [altitude] of max-one-of patches [altitude] ;; altitude of the highest patch
  let range high - low                              ; difference from lowest to highest

  ask patches [
    set altitude altitude - low                    ; Shift every patch down so lowest altitude is 0
    set altitude altitude * 999.0 / range          ; Scale every patch so that the lowest is 0 and highest is 999
  ]

end



to color-patches

  ask patches [set pcolor scale-color green altitude 0 1000]

end

1 个答案:

答案 0 :(得分:2)

如何更换这两行:

ask patch 0 0 [set altitude 1.0]
repeat 100 [diffuse altitude 0.25]  ;; this needs to be changed?

用这个:

ask patches [ set altitude world-width - distance patch 0 0 ]

它不使用扩散,但也许它可以解决你的问题吗?