2

Does anybody know how to implement cellular automata in Java or C#?

tshepang
  • 12,111
  • 21
  • 91
  • 136
lexeme
  • 2,915
  • 10
  • 60
  • 125

2 Answers2

2

I have write a Pseudo-Code implementation that you can use to write a .NET implementation:

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
            }
        }
    }
}

This relies on the fact that the cells have already been initialised with a random value by a noise generator such a Simplex or Perlin noise.

Tuomas Laakkonen
  • 1,280
  • 10
  • 15
1

We need more info, like, what issues have you encountered, difficulties, etc. In the meantime, here are some links to help you:

http://www.primaryobjects.com/CMS/Article106.aspx

http://cplus.about.com/b/2008/08/17/programming-challenge-17-implement-the-cellular-automaton-known-as-life.htm

https://web.archive.org/web/20110503020104/http://www.kim-team.com/blog/2009/06/cellular-automaton-in-net/

Edit: thanks Halil, I've edited the answer to include web.archive.org link.

  • I'm now working on an implementation of some GrowCut extension algorithm and I have never done anything like cellular automata. That's the reason I'm asking you) Thanks! Last resource was useful! – lexeme Mar 16 '11 at 14:20
  • 2
    For those who find out that last link is dead, here is the archive: https://web.archive.org/web/20110503020104/http://www.kim-team.com/blog/2009/06/cellular-automaton-in-net/ – Halil Jan 30 '14 at 07:40