Minecraft wiki entry for Combination_locks, associated text: The horizontal redstone paths on the floor decrease the signal emitted by the comparator down to a fixed strength of 1, and then feed it into an "A OR NOT B" gate that is true if the strength is either too small (B is not powered, i.e. false) or too large (A is powered, i.e. true). These gates are all ORed together so that the overall result is true if any item frame in the lock is misplaced; finally a torch (optional) inverts the result.