DEV Community

Cover image for Cellular automata that mimics reality
No_Arms_studio
No_Arms_studio

Posted on

Cellular automata that mimics reality

    There are many things that cellular automatas have many uses but for this post I will detail now as I said in one of my other blog posts titled "..." is to model populations. I will be talking about modeling human populations.
    As humans if we are alive, we need to have at the very least 1 companion, it's just our nature. But some people are also introverted or extroverted so there could be an rng value from 3 to 9 to mimic this. This is what that would look like:
            If ((item (I) of (Grid#)) = 1)
                    If (n ( > 0 ) and ( n < rnd(3 to 9)))
                            add 1 to (Grid)
                    else
                            add 0 to (Grid)
            else
                    If (n = 2)
                            add 1 to (Grid)
                    else
                            add 0 to (Grid)
    This will give semi interesting results but eventually it just collapses into a fixed state. The next one interests me more because of the fact that It mimics slime mold witch is a kind of mold that slowly grows in the shape of a slime like form, the image above is an example of the algorithm. This rule set makes it so that no sell dies when it is alive and to be created a cell has only 3 live neighbors. The code looks like this:
            If ((item (I) of (Grid#)) = 1)
                    add 1 to (Grid)
            else
                    if (n = 3)
                            add 1 to (Grid)
                    else
                            add 0 to (Grid)
    That simple of code makes something that is truly captivating to watch grow overtime. There really isn't anything more to say. Thanks for reading, have a great day :)
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
no_arms_studio profile image
No_Arms_studio

More cellular automata :)