TerraBool

A Terraria boolean function minifier

About

This app is made to exploit how logic gates and wires behave in Terraria. The main property being how signals don't necessarily turn on a device when power is provided, but rather toogle the on/off state. This property can be used to make circuits, that maximizes use of XOR logic, as connecting two wires together is the same as putting them through an XOR gate.

Find function from truth table

How to use the minifier

ABCDf(A,B,C,D)
00000
00010
00101
00111
01000
01010
01101
01111
10000
10011
10101
10110
11000
1101x
1110x
1111x
ingame example of the function

Type in the output values for the function as a binary number. The given truth table would be entered as xxx0011011001100. (The x'es are don't cares.)

How to interpret a generated boolean function.

First, you must be familiar with logical operations AND(∧), OR(∨), NOT(¬), XOR(⊕), XNOR(⨀).

There are two kinds of XOR used in this app. One is the "parity function" XOR, which will be used without the gate in Terraria, and is implied in the result by writing inputs right after eachother. The other is the "Turns on when exactly one lamp is active" XOR, which means that you have to use that gate in the game, denoted by .

Using the function generated from the example table, we get "¬c ⊕ ¬ac ⊕ ¬cd ⊕ acd"

Here's how this function translates into Terraria

¬c    ¬ac    ¬cd    acd

The operation connecting the terms show which logic gate to use ingame.
The terms show which inputs connect to a single logic gate lamp.
The negation sign in front of a term means that the gate lamp should be in an "ON" state

Not all functions can be expressed with a single logic gate. In these cases, the app will list functions in two columns. choose one from each column, create the two gates ingame, and combine their outputs with a common wire.

(November 2023 update) This version now lists all equivalent functions!

When making multi-output modules, the first result rarely has no wire routing issues. This is why the app now lists all equivalent functions, so you can choose the one that works best for you.