在NetLogo中创建给定区域的随机形状(斑点) [英] Creating a random shape (blob) of a given area in NetLogo
本文介绍了在NetLogo中创建给定区域的随机形状(斑点)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在NetLogo中为给定区域创建随机形状(例如,参见下文)?
Is it possible to create random shapes (see below for example) of a given area in NetLogo?
推荐答案
塞思(Seth)建议1的第一刺.它也创造了整洁的视觉效果!
A first stab at Seth's suggestion #1. It creates a neat visual too!
patches-own [ height ]
to blobbify
clear-all
repeat (ceiling 2 * (ln (world-height * world-width))) [
ask patch (round (random (world-width / 2)) - world-width / 4)
(round (random (world-height / 2)) - world-height / 4)
[ set height world-width * world-height ] ]
while [ count patches with [ height > 1 ] < (world-width * world-height / 4)]
[ diffuse height 1
ask patches with [ height > 0 ] [ set pcolor height ]
]
ask patches with [ height > 1 ] [ set pcolor white ]
end
这篇关于在NetLogo中创建给定区域的随机形状(斑点)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文