有人知道如何用 Java 或 C# 实现元胞自动机吗?
问问题
4891 次
2 回答
2
我编写了一个伪代码实现,您可以使用它来编写一个 .NET 实现:
function automate(cells,bornlist,survivelist,iterations)
{
loop(iterations)
{
loop(row < height)
{
loop(collumn < width)
{
if(is edge)
{
alive = true
}
else
{
num = add states of all cells around the outside (if in 3d include above and below and use less iterations)
state = cells[row,collumn]
alive = (state = 0 and bornlist.contains(num)) or (state = 1 and survivelist.contains(num))
}
cells[row,collumn] = alive ? 1 : 0
}
}
}
}
这依赖于这样一个事实,即单元已经由噪声发生器(如 Simplex 或 Perlin 噪声)使用随机值初始化。
于 2013-11-26T20:06:45.003 回答
1
我们需要更多信息,例如,您遇到了什么问题、遇到的困难等。同时,这里有一些链接可以帮助您:
http://www.primaryobjects.com/CMS/Article106.aspx
编辑:谢谢 Halil,我已经编辑了答案以包含 web.archive.org 链接。
于 2011-03-16T12:51:45.633 回答