Hoiktronics: Functional in-game Terraria Computer

DicemanX

Brain of Cthulhu
Thanks to ZeroGravitas and his work on hoiktronics, I present my version of an early Terraria computer with arithmetic functions. Here's a video of the computer in action:




Terraria Computer:

9YVJyzm.jpg


Computer Wiring:

EAWacFg.jpg



How the Binary Computer Functions:

The computer consists of three registers:

1) 8-bit Memory Register (output via orange numbers bottom right of the player corridor)
2) 8-bit MQ Register (output via yellow numbers top right of the player corridor)
3) 9-bit Accumulator Register (output via yellow numbers above the player corridor)

The registers hold numbers from 0-255 for the 8-bit registers, and 0-511 for the 9-bit register. The number that's held can be determined by summing up the numbers in the registry display that are lit up. For example, let's suppose that the following numbers are lit up:

963EB4A35013D3C43A7567ACC54D4C012212E2D7


The Accumulator Register holds 16+32+256 = 304
The MQ Register holds 16+32 = 48
The Memory Register holds 8+64+128 = 200

3 levers control the mathematical operations:

1) The M lever (for multiplication, addition, and subtraction)
2) The C lever (complement for subtraction and division)
3) The Q lever (for determining quotients when dividing)

Two additional levers:

1) The 0 lever (CLEAR function - sets all registers to 0)
2) The T lever (translates the binary output in the Accumulator Register to a Decimal output using seven-segment 0-999 display)


Computer Arithmetic:

The way multiplication works is to take the information stored in the Memory Register and add it to the Accumulator Register. The number of times that the info is added is determined by the MQ Register. For instance, if the Memory Register holds 87, and the MQ register holds 5, then 87 will be added 5 times to the Accumulator Register. After the process of adding is finished, the output in the Accumulator Register will be 87x5 = 435.

Addition is essentially multiplication by 1. The content of the Memory Register is added to the Accumulator Register once. For instance, if the Accumulator Register holds 34, and the Memory Register holds 210, then 210 will be added once to 34 (so long as the MQ Register holds 1) for addition of 210+34 = 244.

Division and subtraction are more complicated, and require taking the complements of numbers. Since this is meant to be a more basic guide, I will instead give the protocols for all arithmetic operations below and let you have the fun of figuring out how everything works.


Programs:

To make the presentation of the programs more user friendly, I will use the the terms "activate" if a lever needs to be pulled, and "set" if a register needs to be set to a certain value (values will be denoted by the variables X, Y, and Z). To execute a program the instructions need to be followed from top to bottom. I will stick to basic programs for the time being, and in a later guide describe more advanced functions.

Multiplication Program:

Activate CLEAR lever
Set MQ Register to X
Set Accumulator Register to 0
Set Memory Register to Y
Activate M lever

Result: Accumulator will show the outcome of X times Y.


Addition Program:

Activate CLEAR lever
Set MQ Register to 1
Set Accumulator Register to X
Set Memory Register to Y
Activate M lever

Result: Accumulator will show the outcome of X plus Y. Since the MQ Register is set to 1, the contents of the Memory Register are only added once to the contents of the Accumulator Register.


Subtraction Program:

Activate CLEAR lever
Set MQ Register to 1
Set Accumulator Register to X
Set Memory Register to Y
Activate C lever
Activate M lever

Result: Accumulator will show the outcome of Y minus X. Note that the smaller number in the subtraction should go into the Accumulator Register, and the larger number should go in the Memory Register (i.e. Y > X). This machine can handle negative numbers, but that will be the subject of discussion in a later more comprehensive guide.


Division Program:

Activate CLEAR lever
Set MQ Register to 255
Set Accumulator Register to X
Set Memory Register to Y
Activate C lever
Activate Q lever

Result: The MQ Register will show the outcome of X divided by Y. To keep it simple make sure that X is a multiple of Y to avoid non-integer values. This machine can handle fractions, but again I will describe how in a later guide. Note that the MQ Register always has to be set to its maximum value when doing division, and it's the MQ Register, not the Accumulator Register, that will hold the answer to the division problem.


Conversion from Binary to Decimal:

After a calculation is completed and the result is in the Accumulator Register, the binary number stored there can be converted to a decimal value by activating the T lever. The conversion takes about 1 second for every 10 digits converted, so for instance if the Accumulator holds 140 then it will take about 14 seconds to convert that into decimal. The decimal display has to be reset by hand using the three switches (one switch for each digit) next to the display.


World Download:

http://www.filedropper.com/dicemanxhmworldv51_2

I strongly encourage you to download this world and try out the computer for yourself. See if you can also figure out the actual mechanism by observing the computer in action! We're well on our way to building even more complicated machines in Terraria thanks to ZeroGravitas introducing us to hoiks and hoiktronics!


ZeroGravitas' version (first ever published version of a working in-game computer):



ZeroGravitas' Guide to Hoiktronics:

http://forums.terraria.org/index.php?threads/hoiktronics-what-is-it-guide.8371/
 
Last edited:
Computer Wiring:

EAWacFg.jpg
I nominate this for wiring diagram of the year! That's a must-subbit to the creation conpendium! The control area of your great machine has such presence it could do with an ashphalt floor, lol! Epic.

Nicely laid out guide up there, too! Makes things clearer than my attempt at a functional explanation in my vid, I think.
 
I swear though, while I myself have never tried using hoiks in any way or form, this is something impressive. I just hope Red will see the possibilities with hoiks and never fix it.
 
@DicemanX Could you also post this amazing thread in T-MEC group?

I'll be presenting certain components used in this set-up in T-MEC. I presented my version of the reset mechanism which I used to clear registers already, and of course the decimal display was a component of the 24hr clock that was presented in another thread. Next, I plan to present how to speed up the signaling by creating loops instead of relying on teleporters and using up to 10 skeletons simultaneously. Should be interesting!
 
Hey. i want to show my opinion.. ive seen some post of hoiks. and yeah. its cool. its very interesting(i was 1 year studying electricity/electronique and i know good what you do) and yeah
its good job. BUT... its a lot of job.. Zerogravitas. you are the SETHBLING(minecraft) of Terraria. but we have very low utilities/tools for maximize what we want without waste a lot of time and without do hard sistems
Like minecraft with sethbling. i hope terraria will talk with you to help to improve thr system of electricity in Terraria!. Greetings from spain. good job
 
Zerogravitas. you are the SETHBLING(minecraft) of Terraria. but we have very low utilities/tools
Thanks for the kind words :), but even if my brain worked for more than 1/4 of the time, I'd still not be half the YouTuber he is: pretty awesome from a quick flick through his channel...

Anyway, if you have any specific wiring/engineering suggestions, that you think would improve the game for us, you could certainly add them to the T-MEC suggestions thread. I've not really pushed for very much, it's not my really style, but if you (or anyone else) comes up with something brilliant I'll certainly support it.
 
Back
Top Bottom