General Generations Cellular Automata Interpreter

Hello all,

Recently I have been very interested in all things cellular automata, specifically Conway’s game of life. I knew there were others, but not how many others and the different categories. But then I found this site with all the different categories listed: When I saw this, the first category that I happened upon was the Generations category, which is very similar to the normal game of life but with different rules for cells being born/dying and also “history” cells, which simply decay over time. There were so many but with so simple rules that I knew I had to make an interpreter, so here it is: It can run any of the automata under this page: It can generate very interesting patterns especially with the Star Wars rule(which I have preset), and I think it is amazing that such simple rules can produce such complex patterns.

Later I am hoping to expand this project, likely using class inheritance from a single, basic life class to this and perhaps even the WireWorld cellular automata. I also would like to build in support for Conway’s game of Life, but seeing as I already have a project for that posted to the forums I saw no need.

If you have any suggestions, be sure to let me know. When you see a pattern on the website, it is in the form S/B/C(survival/birth/count(of states)), which in turn can be put into my code when lg is defined as an instance of LifeGenerations - the first parameter is a table of all the S values(which should be separated by commas, unlike how they are on the website), the next is a table of the B values(also separated by commas), and the third is just an integer representing how many states the cell can be in(including 0) so that number can be directly copied from the rule set. The next parameter is the size of the grid, and the final parameter is the number of frames between each calculation(also able to be changed with a slider while the program is running). If you have any questions on how this works, ask and I’ll see if I can answer them.


Is there a simple way to copy/paste this into Codea all at once, or do you have to copy/paste each file separately?

Star the repo (you have to be signed into GitHub). Buy the Working Copy app. From Working Copy main page press +, clone, GitHub, scroll down to see all your GitHub repos, then all the repos you’ve starred. Select the one you want to clone. Select the folder that has the lua files. Press the share button, export to Codea. Open Codea. Long press +. Select paste into project.

Wait, it’s only two files. Is there a laziness bug going around today? :stuck_out_tongue:

Here, have an installer anyway, assuming that copy and paste isn’t too much effort. Kids these days >:)

local url = ""

local function install(data)
    --parse plist into list of tab files
    local array = data:match("<key>Buffer Order</key>%s-<array>(.-)</array>")
    local files = {}   
    for tabName in array:gmatch("<string>(.-)</string>%s") do
        table.insert(files, {name = tabName})
    --success function
    local function success(n, name, data)
        if not data then alert("No data", name) return end
        print("Loaded "..n.."/"..#files..":"
        files[n].data = data
        for _,v in ipairs(files) do
            if not then 
                return --quit this function if any files have missing data
        --if all data is present then save...
        for i,v in ipairs(files) do
            print("Saved "..i.."/"..#files..":"
        for i,v in ipairs(files) do --load...
        setup() --...and run
    --request all the tab files
    for i,v in ipairs(files) do 
        local function retry(error) --try each file twice, in case of time-outs
            print(error," not found, retrying")
            http.request(".lua", function(data) success(i,, data) end, function(error2) alert(error2," not found") end)
        http.request(".lua", function(data) success(i,, data) end, retry)
http.request(url.."Info.plist", install, function (error) alert(error) end)

How would you have survived typing in 2000 lines of code from a magazine like in olden days?

And then having to wait till the following month to get the list of bugs that you had you fix… And don’t get me started on saving files to tape :slight_smile:

I remember typing in programs from the magazines. It was tedious but also exciting.

Before that, I used punch cards at university. You would punch your cards, put a rubber band around them and put them in a box, then come back later and hope to see them with a printout wrapped around them. If the printout was one page, you could expect to see an error. That slow process made you really, really check your code.

Anyone remember the Dragon 32? I think it was pretty much UK only. Maybe even Wales only.

(With apologies to @TheSolderKing for hijacking the thread. Nice automata by the way! :slight_smile: )

No worries @yojimbo2000 , I only started coding 3 years ago so it’s very interesting to me to hear from people who have been doing it for longer than I have. I have never experienced anything much more than the current types of computers and languages I have always worked on, so it’s really cool to hear about how programming was done in the past. My first computer that I really used and programmed on was a ~2006 iMac that I used until 2014 :stuck_out_tongue: and it was ridiculously slow by the end. I had an old Dell laptop before that, but I rarely used it other than for a few games that were Windows specific and hardly understood how it worked.