# [Showcase] Elementary Cellular Automaton | Massive 1.3.1 Wiring Creation

#### idkwhoiam129

##### Steampunker
Hello hello! Since the release of the 1.3.1 update, I've been very busy with the new logic gates and wires. I decided to get straight to it and build a display for elementary cellular automaton. Now if you don't know what this is, I'll give a description from the wolfram website: http://mathworld.wolfram.com/ElementaryCellularAutomaton.html

Elementary cellular automata have two possible values for each cell (0 or 1), and rules that depend only on nearest neighbor values. As a result, the evolution of an elementary cellular automaton can completely be described by a table specifying the state a given cell will have in the next generation based on the value of the cell to its left, the value the cell itself, and the value of the cell to its right. Since there are 2x2x2 = 2^3 = 8 possible binary states for the three cells neighboring a given cell, there are a total of 2^8 = 256 elementary cellular automata, each of which can be indexed with an 8-bit binary number (Wolfram 1983, 2002). The possible values of the three neighboring cells are shown in the top row of each panel, and the resulting value the central cell takes in the next generation is shown below in the center. The evolution of a one-dimensional cellular automaton can be illustrated by starting with the initial state (generation zero) in the first row, the first generation on the second row, and so on.

So, on with the video!

Here's a video to explain each cell:

And here are some screenshots of the build:

Screenshot from TEdit:

Some of the wiring:

Screenshot of the map:

Last edited:
One heck of a build, though it feels like it has too many blank spaces, can be compacted a lot /

One heck of a build, though it feels like it has too many blank spaces, can be compacted a lot /
Sadly, yes, there are many blank spaces, but it cant be compacted much because wires would cross, cells would overlap, and there needs to be room for the logic gates and busing.

Ahh, marvelous! I have "A New Kind of Science" literally sitting on the desk next to me, since a little while before the update (exerting an almost palpable gravitational pull, heh - it's not lightweight). I had in mind to have a go at implementing one pretty cellular automaton rule, perhaps, at some time in the (probably) distant future. But you've just gone and done them all. And in under a week!Jealous? A little. Congrats! And welcome to little old T-MEC.

Above left: rule 30 (of 256). Above right: rule 90.​

Would it be likely to mean much to us if you were to pull up the wiring for just one cell an annotate it a little? Are you planning to refine the interface of your build or any aspect of it, at all? Are you a long time Terraria player, or did you mostly get drawn in from Minecraft by the wiring update? Are you ok with me asking you questions? (I hope so!)

Presumably you could make a much more compact, faster setup by hard coding the rules into place? Think there's any chance of stretching things to a 2D automaton? Because obviously being able to say that you built "The Game of Life" inside a computer game would be pretty epic bragging rights.

Last edited:
Ahh, marvelous!...
Ah, thank you so much! I can very well do an explanation of a single cell. I don't plan on refining it, although I'm sure improvements are possible. I have been playing Terraria since 1.0.5, but never really got in to the "mechanical" side of it until recently. I was drawn over from Minecraft, with the logic gates of course, which added an endless number of possibilities to the game. And I'm perfectly fine with you asking questions!

The rules are essentially hard coded in for each of the 8 triple cell state possibilities, but the busing is was takes up most of the space. Each cell has to take the same 8 bit bus, in order to apply the same rule to each cell. (of course it would be possible to hard code in a single "rule", but then it could only represent one, and whats the fun in that?") As well as that, the output from each cell has to be divided in to 3 to go to the next 3 deciding factors for the next cell for the next generation.
I do believe a game of life would be possible, Although I'm sure it would be rather difficult, each cell requiring a D flip flop and a set of hard coded rules.

of course it would be possible to hard code in a single "rule", but then it could only represent one, and whats the fun in that?"
Yeah... It wouldn't really be demonstrating the emergent beauty when you're pretty mush just lighting up one pattern, pretty arbitrary. Equally as tricky to give a fair impression of that, though, when each cell is a nest of wires as tall as the screen!...

I do believe a game of life would be possible, Although I'm sure it would be rather difficult, each cell requiring a D flip flop and a set of hard coded rules.
Woot. Well, a flip-flop is easy enough:
But yeah, those rules, having to check 8 cells around it and itself and doing a greater or less than (3?) check (right?).

BTW, feel free to browse the rest of our threads here and point out any of my (probably numerous) technical errors (and typos).

Woot. Well, a flip-flop is easy enough:
I can't quite tell what gate that is. To me it looks blue, and there are no blue gates haha.

But yeah, those rules, having to check 8 cells around it and itself and doing a greater or less than (3?) check (right?).
Yes, they'd have to each individually receive 8 bits from neighbors, and send it's own status to the 8 cells as well. There would thankfully only need to be 4 checks though. Although the checks, I'm not sure how I would do those quite yet. They would have to calculate the number of neighbors and see if there are 0 or 1, 2 or 3, 4 or more for populated cells, and 3 neighbors for unpopulated cells. I'm not sure how I would check how many of the neighbors are on.

BTW, feel free to browse the rest of our threads here and point out any of my (probably numerous) technical errors (and typos).

Thank you! I've looked around a bit and it seems like a wonderful community.

there are no blue gates
That's a good quote. Heh. Check out what the "faulty lamps" from the steampunker do to any gate. Many threads have utilized them here now. Very handy.

That's a good quote. Heh. Check out what the "faulty lamps" from the steampunker do to any gate. Many threads have utilized them here now. Very handy.
Oh yes, I've figured it out! Although that looks more like a T flip flop than a D flip flop to me...

You know, if we'd had this update half a year ago, I could've mentioned you in a presentation I gave on cellular automata.

But seriously - how do all of you guys conjure up the impetus to implement these things? Even if copy&pasted in TEdit, this is a hell of a build!

You know, if we'd had this update half a year ago, I could've mentioned you in a presentation I gave on cellular automata.

But seriously - how do all of you guys conjure up the impetus to implement these things? Even if copy&pasted in TEdit, this is a hell of a build!
honestly, the hardest part of the build was not building each cell, but making sure the timing was correct. If all the cells updated at the same time, the logic gates would "burn out" and it would break the build. So I spent most of the time trying to figure out a way to make the timing of the build work. I tried hoiks with dummies, but they were glitchy and despawned a lot. I eventually came up with a timer that would pulse once then turn itself off, and that was the key component to making the timing work .

Also, just an update, I added a video to the main post that explains how each individual cell works

that looks more like a T flip flop than a D flip flop to me
Well, it flips... and it flops... that's usually good enough for me. Tweak as needed...? (Or build from scratch, using gates, although some configurations don't work, due to looped back double activations.)

So I spent most of the time trying to figure out a way to make the timing of the build work.
Implementation is definitely the hard, unaccredited, slog, compared to just throwing idea up in the air. That's for sure. Good effort.
I tried hoiks with dummies, but they were glitchy and despawned a lot.
Really? They should not ever despawn, once they have been initialized (didn't in 1.3.0). Max 100 though. Also, if you were moving/copying dummy stands about in TEdit, yes, that would have made a glictchy mess (and we don't have Mechmod to fix that currently).

I could've mentioned you in a presentation I gave on cellular automata.
Oh cool, as part of your education or work? (Or, well, both?)

I added a video to the main post that explains how each individual cell works
Aw, cool. It looks relatively tractable, when you break it down like that. I didn't really know (or remember) how the rules were enumerated, but it looks like they translate to logic gates very directly: Just one of each OR gate for each possible combination of it's 3 input state toggles (1 -> 1, or 1 -> 0), from the 3 cell states that are appropriate for it to read. Then enable output from each of those, based on which rule is selected, directly in binary, pooling all the outputs such that the cell will be on if there's an odd number of enable OR outputs that send a 'high' signal (and cell off if it's an even number). Am I close in what I'm saying (if not particularly insightful)?

It seems to me that there's no real need to have any more than a single row of automata calculation cells. After all it is supposed to be a 1D (plus time) structure. You could just shift the bits out and up columns of bit shifters, each step, printing out the history of the states. Obviously the shifters won't require much space (or wiring/processing), so the rows could be relatively close together. Then you could focus on just making calculation mechanisms as narrow as possible. (It looks like you could use junction boxes for ducting adjacent wires of the same colour, and maybe other re-arrengements to shave a few tiles).

One could go a step further, and have only one one calculation 'cell', and instead look along the row of bit states (for the previous step), one at a time. Kinda like a moving tape head (or multiplexer). Not sure that this would be more space efficient, and definitely add in an extra complication...

Well, it flips... and it flops... that's usually good enough for me. Tweak as needed...? (Or build from scratch, using gates, although some configurations don't work, due to looped back double activations.)
There's actually a large difference between D and T flip flops.

The T Flip Flop only has 1 input. The T flip-flop changes state ("toggles") whenever the T-input is strobed.

The D Flip Flop has 2 inputs. The D flip-flop captures the value of the D-input at the rising edge of the the clock cycle. That captured value becomes the Q-output.

I've built a D flip-flop in game that works, but now that I think about it, a t flip flop might be more suitable. But here is the D flip flop if anyone wants it for reference:

Really? They should not ever despawn, once they have been initialized (didn't in 1.3.0). Max 100 though. Also, if you were moving/copying dummy stands about in TEdit, yes, that would have made a glictchy mess (and we don't have Mechmod to fix that currently).
It was most definitely the max 100, haha. Oops!

Aw, cool. It looks relatively tractable, when you break it down like that. I didn't really know (or remember) how the rules were enumerated, but it looks like they translate to logic gates very directly: Just one of each OR gate for each possible combination of it's 3 input state toggles (1 -> 1, or 1 -> 0), from the 3 cell states that are appropriate for it to read. Then enable output from each of those, based on which rule is selected, directly in binary, pooling all the outputs such that the cell will be on if there's an odd number of enable OR outputs that send a 'high' signal (and cell off if it's an even number). Am I close in what I'm saying (if not particularly insightful)?
They do translate the gates directly, one of each OR for each possible combination of 3 inputs. And each is selected directly in binary, but it doesn't have to do with even or odd. If any number of the 8 possible rules are matched, then the output is "high" as well.

It seems to me that there's no real need to have any more than a single row of automata calculation cells. After all it is supposed to be a 1D (plus time) structure. You could just shift the bits out and up columns of bit shifters, each step, printing out the history of the states. Obviously the shifters won't require much space (or wiring/processing), so the rows could be relatively close together. Then you could focus on just making calculation mechanisms as narrow as possible. (It looks like you could use junction boxes for ducting adjacent wires of the same colour, and maybe other re-arrengements to shave a few tiles).
That's a very good observation! Although, there are many rules that are seemingly random or know no "pattern". And some are in patterns or 2 rows, or 3, or 4. There would be no good way to tell where each pattern goes.
Take pattern 105 for example:

It wouldn't be possible to shift that in any way.

One could go a step further, and have only one one calculation 'cell', and instead look along the row of bit states (for the previous step), one at a time. Kinda like a moving tape head (or multiplexer). Not sure that this would be more space efficient, and definitely add in an extra complication...
This could possibly work? I'm not sure. It would be working more in a serial fashion than parallel... I'm not sure exactly how I would do it, but I'm sure its possible.

Oh cool, as part of your education or work? (Or, well, both?)
Education. It will be quite a few years until I enter work life, especially if I keep wasting spending my time on building computers inside of computer games.

There's actually a large difference between D and T flip flops.
-snip-
I think we should make a thread containing a list of various different components including name, how it works in electronics, how to build it in Terraria as compact as possible and how to use it - transistors, T-flip-flops, D-flip-flops, RS-latches etc. Free bonus would be that we could force our terminology on everyone else.

I think we should make a thread containing a list of various different components including name, how it works in electronics, how to build it in Terraria as compact as possible and how to use it - transistors, T-flip-flops, D-flip-flops, RS-latches etc. Free bonus would be that we could force our terminology on everyone else.
I do love this idea. I was actually thinking of making a showcase world with all of these components, but a thread works as well.

I think we should make a thread containing a list of various different components including name, how it works in electronics, how to build it in Terraria as compact as possible and how to use it - transistors, T-flip-flops, D-flip-flops, RS-latches etc.
I was actually thinking of making a showcase world with all of these components
Absolutely, do both! Lol. Link out to all the existing threads that have these things in too, if you would, for reference. There's a lot of useful info out there already, in replies and in badly non-obviously named threads.