Hoiktronics: Simple Logic Gates

inomanoms

Eye of Cthulhu
Hi!

My name is @inomanoms, and I have been a member of the T-MEC forums for some time now, making builds and posting guides. I thought I would break out the T-MEC bubble and address a broader audience with this post on a universal logic gates. When 1.3.1 hits and logic gates are introduced to the game as an item, the build shown below will be pretty much rendered obsolete. The point of this guide, however, is to show how with the scant engineering resources Terraria provides, it is already possible to create all the basic logic gates used in electronics.

Every now and then, we get new members to T-MEC, likely with an electronics engineering background, who are bewildered by Terraria's wiring system, and make claims that certain things can't be done in Terraria as they are in real life. Not too long ago, Joe, @DicemanX, posted a guide on how to make complex logic gates. In that guide, he shows us how with a line-decoder, coupled to memory and a global reset mechanism, efficient and complex logic gates can be created in Terraria. The build below follows in pretty much the same footsteps, only that memory (for the terminus) and memory reset has been integrated into the gate locally, and that the gate can be changed at any time by the user in game to be any of the basic gates. This is a move away from the large and custom logic gates Joe has presented us with. In general, any mechanical build will run faster if memory reset are defined globally and outside the mechanisms use time. But for those with a familiarity in electronics, and who are accustomed to combining logic gates into larger constructions, I hope this will be of some use.


Capture34.PNG

http://www54.zippyshare.com/v/3aZmh4om/file.html
Capture34w.PNG Capture34r.PNG Capture34b.PNG Capture34g.PNG

I will be identifying the parts of the above build, but not delve into why it works. If you are interested in understanding how the logic gate works, I encourage you to visit the T-MEC forum, where many resources on Terrarian engineering can be found and your questions can be entertained.

The build uses a dummy ghost (C) who is teleported into and cycled through the mechanism upon execution. Immediately above the input and execution interface (A), is the three-way junction (D) that the mechanism uses to disambiguate the input signals sent to the logic gate into the 3 classes, 11, 10 or 01, and 00. From here, the dummy ghost is moved to the appropriate tele-hoik in the column of tele-hoiks on the lefthand side of the build (E). From this column, the dummy ghost relays the toggle output of the gate to the impulse junction (G) as it is defined by the user in the output truth table (B) of the build. Then, the dummy ghost moves through memory (F) in order to modify the impulse junction to respect the terminus before finally passing through the impulse junction (G), to send out the resulting impulse while simultaneous resetting the impulse junction.

Because of the density of the wiring, it is difficult not to use different wire colours for the inputs to the logic gate. So, in order to be able to chain gates, the part of the mechanism below the main portion (H), converts wire signals from red (colour of the output wire) to green and blue. NB, the build assumes that the gate connected to the left tele-hoik, is the gate that is passing along its hoiking actor, so you need to be careful that the gate connected to this tele-hoik is the gate of the branch of longer chained gates, and not include a dummy statue in the chained gate.

Using this universal logic gate, any of the basic electronic gates can be made: AND, NAND, OR, NOR, XOR and XNOR. Although any of these gates can be directly defined from the output truth table, I have included a switch left of the execution lever which inverses output state, so you could enter the truth table for AND and use the switch to get NAND. You can even do negated input gates with the input switches since these are not used to define the input when gates are chained. NB, the truth table is inverted with 1 at the top, 0 at the bottom.

This is my first post in the "Guides" forum. If you've found this useful or interesting, please leave a like! Here is a list of links to polished guides and builds I've published on the T-MEC forum:


(@ZeroGravitas, @DicemanX, @Yoraiz0r. /Waves!)
 
Last edited:
OK, so finally had a proper look at this, well, I tried. It's tricky. For one, as you say, the new logic gates seem likely to make this redundant, so the motivation for other to figure this stuff out is lacking. Also, although well laid out, mentally trying to attach the desription of function to the diagram was very hard for me. I'm not clear exactly what switching the player flicks, or suchlike, to select each logic operation type, or where the inputs and outputs are, if you were to chain them. Maybe a diagram lining up the configuration/switch states with the equivalent logic gate symbols, and/or a tick by tick animation would give the reader more purchase to figure out what's going on (next time maybe).

You've indexed some of your other builds/guides here too, which is great, I forgot what/where everything is. Do you have a link to the little figure you once drew, i think, showing the order of precedence for which hoik teeth positions take precedence, in the tiles under the player? (Think it was just a discussion reply, not sure if we put it up anywhere obvious too - I should have added it to my hoik guide.)
 
Also, although well laid out, mentally trying to attach the description of function to the diagram was very hard for me. I'm not clear exactly what switching the player flicks, or suchlike, to select each logic operation type, or where the inputs and outputs are, if you were to chain them. Maybe a diagram lining up the configuration/switch states with the equivalent logic gate symbols, and/or a tick by tick animation would give the reader more purchase to figure out what's going on (next time maybe).

The confusion in the wiring of the build comes primarily from the way I've "packed" the tele-hoiking modules in order to achieve spatial efficiency. Laid out linearly, (A through G, left to right), the mechanism is (well, firstly, much easier to create, but also) much easier to follow.

I did not think understanding how to use the gate would be as unintuitive as you describe it to be. Selecting your logic operation type is a matter of defining the output table/list in the vertical corridor (B) that runs up through the build. This list is inversed so that, for instance, to create an OR gate:

Code:
1 1            = 1
1 0 or 0 1     = 1
0 0            = 0

you would flip the top two switches in the corridor. The diamond gemspark blocks next to these switches serve as a visual confirmation of the true/false output states, with true being the gemspark block turned on. The choice of input is made in the input and execution area of the build (A) via the switches which have halfblock topaz gemsparks over them and are to the right of the large execution lever. Again, true is on. These switches can be interpreted as input states, or, if the logic gate has been chained, as a means of input impulse negation. The resulting output can be read from the red and green bars at the top right of the build. Red is false, green is true. These will not toggle on repeated execution of the gate under unchanged conditions.
 
Last edited:
Back
Top Bottom