4-bit comparators are a basic building block in electronics, and useful in many redstone devices, in particular computers. I'm interested in a good overview of the construction this type of device. It takes eight signals as input: a0, a1, a2, a3, b0, b1, b2, b3
; and outputs 2 signals: a<b, a=b
with a>b = !(a<b)
.
Diagrams of how to do it with real electronics are easy to find. Usually people build 1-bit, 2-bit, and 4-bit comparators directly, and larger ones are created through cascades (to minimize the number of transistors used). Translating this to minecraft is a bit of an art; sometimes a more complicated circuit in reality is easier to do (and works better) in minecraft. There's these points to consider, roughly in order of importance:
- Maintainability
The plan should be for the device to remain functioning as the game is updated. Answers using bugs or undefined behaviour would result in the device no longer working as the game updates, making these less useful.
- Speed
There's usually an expectation that whatever redstone contraption is providing the logic functions fast enough that the delay isn't noticeable.
- Simplicity
If the device is meant as a tutorial, it should be easy enough to understand, and not rely on too much obscure behaviour.
- Compactness
A device using a minimal amount of material is quicker to build and easier to fit in.