## On the Subject of the Logic CM

A machine that knows no bounds when it comes to ciphers.

First, figure out which logic gate the cipher is using. Turn the numbers on screen 4 into 6 digit binary numbers. Then using the left number as the left bits, the middle number as the right bits, and the third number as the resulting bits, find out which gate it is by using the following table:

INPUTANDORXORNANDNORXNOR-><-!-><-!
000001111100
010111001001
100111000110
111100011100

If the Boolean Expression on screen A is true, treat the encrypted word as the right letters and the key on screen 1 as the left letters.
Otherwise, treat the encrypted word as the left letters and the letters on screen 1 as the right letters.

For each letter of the left letters and right letters, do the following:

• Convert the Nth left letter and Nth right letter into a 5 digit binary number (A = 00000, B = 00001...Z = 11001).
• If the Nth bit of the binary on screen 2 is a 1, invert the left binary bits.
• If the Nth bit of the binary on screen 3 is a 1, invert the right binary bits.
• Take the left and right binary numbers and apply the logic gate to them.
• Turn the resulting binary bits back into a letter (00000 = A, 00001 = B...11001 = Z)

The resulting letters should form a decrypted word

 A N 00000 01101 00001 01110 00010 01111 00011 10000 00100 10001 00101 10010 00110 10011 00111 10100 01000 10101 01001 10110 01010 10111 01011 11000 01100 11001
 00 16 32 48 000000 010000 100000 110000 000001 010001 100001 110001 000010 010010 100010 110010 000011 010011 100011 110011 000100 010100 100100 110100 000101 010101 100101 110101 000110 010110 100110 110110 000111 010111 100111 110111 001000 011000 101000 111000 001001 011001 101001 111001 001010 011010 101010 111010 001011 011011 101011 111011 001100 011100 101100 111100 001101 011101 101101 111101 001110 011110 101110 111110 001111 011111 101111 111111

#### Example 1

Encrypted Word: JIVNNXEB
Logic Key: CDXJPYPF
Gate: AND
Screen 2: 11010000
Screen 3: 01000111
Boolean Expression: True

C, J → 00010 + 1, 01001 + 0 → 11101 AND 01001 → 01001 → J
D, I → 00011 + 1, 01000 + 1 → 11100 AND 10111 → 10100 → U
X, V → 10111 + 0, 10101 + 0 → 10111 AND 10101 → 10101 → V
J, N → 01001 + 1, 01101 + 0 → 10110 AND 01101 → 00100 → E
P, N → 01111 + 0, 01101 + 0 → 01111 AND 01101 → 01101 → N
Y, X → 11000 + 0, 10111 + 1 → 11000 AND 01000 → 01000 → I
P, E → 01111 + 0, 00100 + 1 → 01111 AND 11011 → 01011 → L
F, B → 00101 + 0, 00001 + 1 → 00101 AND 11110 → 00100 → E

Decrypted Word: JUVENILE

#### Example 2

Encrypted Word: HLIRN
Logic Key: HOOEJ
Gate: !->
Screen 2: 01001
Screen 3: 11000
Boolean Expression: False

H, H → 00111 + 0, 00111 + 1 → 00111 !-> 11000 → 00111 → H
L, O → 01011 + 1, 01110 + 1 → 10100 !-> 10001 → 00100 → E
I, O → 01000 + 0, 01110 + 0 → 01000 !-> 01110 → 00000 → A
R, E → 10001 + 0, 00100 + 0 → 10001 !-> 00100 → 10001 → R
N, J → 01101 + 1, 01001 + 0 → 10010 !-> 01001 → 10010 → S

Decrypted Word: HEARS