NOT gates the simplest type of logic, as they only use one input. These gates are implemented by default, by simply changing whether the target starts enabled or disabled.
AND gates are also implemented into the code by default. Whenever two buttons are connected to a single output source, the output source will only enable once both inputs are enabled. A NAND gate can be implemented by flipping the initial state of the output, as per a NOT gate.
OR gates are the simplest logic not hard-wired into the game. There are two ways of creating an OR gate, one requiring lasers and one not.
|laser relay. Thus, if either laser is on, the floor relay is also on. This can then be hooked up to an exit.|
An XOR gate is the most complex of these gates. It should only be active if one of the two inputs is active, but not both. It requires a combination of two AND gates, one NOT gate, and one OR gate. The logic is as follows: Combine both inputs into an OR gate. Simultaneously combine them into an AND gate. If the OR returns true AND the AND gate returns false, then return true.
An alternate method involves two excursion funnels. By causing them to intersect, they will hold an object in between them in stasis, preventing it from moving. However, if only one funnel is on, the object will hit an appropriate button. If neither is on, it will fall to the floor. By using an OR gate on the two outputs, this forms an XOR gate. Note: You must use an edgeless safety cube for this, as a normal cube is too large, and may accidentally enable a button while both funnels are on.