On the Subject of Pandemonium Cipher

A cipher named after the plane of tunnels, where you'd be stuck walking around forever.

The module displays two panels with seven letters each, a submit panel with an extra letter on it, and a lettered grid with four buttons referring to their respective directions.

You can press a panels to cycle it. The top row shows an encrypted word and a keyword. The bottom row shows two other keywords. The extra letter on the submit panel is a keyletter.

To solve the module, decrypt the word following the steps below and submit it using the grid. To submit, press the directional buttons to move to the letter you want to submit, and press the submit button. For x use the keyletter instead. You can always cycle the top panel to clear your input.

Decrypting the word

Step 0 - Creating your key

For steps 1, 2 and 3 you need a key. To make this key, make an empty 5x5 grid. Then take your keyword from the top panel. For each letter take its alphanumeric position ignoring any x in both the keyword and the alphabet (meaning the alphabet is A1Z25) and place the first unplaced letter of this alphabet on the grid at that position in reading order. If a position is already occupied, go to the next square in reading order until you arrive at an available square. Loop around in both the grid and the keyword where necessary.

Example: BELLOWS

-A--B
-----
-CD-E
---G-
--F--
UAHOB
IPVWY
ZCDJE
KLQGN
RSFMT

Step 1 - Global Offset Cipher

Take your encrypted word from the top row, the key from step 0 and the keyletter on the submit panel. Look up each letter of your encryption in the grid and move it in the same way as you would to get from the center to the keyletter, wrapping around if necessary. Any x gets ignored and stays an x.

Example: YURFVHI, C -> WBTSPAY

UAHOB
IPVWY
ZCDJE
KLQGN
RSFMT

Step 2 - Parallelogram Cipher

Take your encrypted word from previous step, the key from step 0, the keyletter on the submit panel, and the two key words on the bottom row. Replace any x in the keywords by the keyletter. Ignore any x in the encrypted word. For each letter, compare it to the position of the corresponding letter in both of the keywords. Add up the movements required to go from the encrypted letter to the other letters and move starting from the letter of the encryption using this movement you added up, wrapping around if necessary. This letter is the new letter for that position.

Example: WBTSPAY, COHABIT HOOVERS

W, CH -> I
B, OO -> H
T, HO -> P
S, AV -> D
P, BE -> V
A, IR -> B
Y, TS -> C

UAHOB
IPVWY
ZCDJE
KLQGN
RSFMT

Step 3 - Jump-Over Cipher

Take your encrypted word from previous step, the key from step 0 and the keyletter on the submit panel. Ignore any x in the encrypted word and put them back after decrypting. Start on the keyletter. Jump over the first letter of the encrypted word, where the movement you make would be the movement from the keyletter to the first letter, but repeated once more. Wrap around if necessary. Use the letter you end on as the first decrypted letter. Start from here and jump over the second encrypted letter to get the second decrypted letter and so on.

Example: IHPDVBC, C

UAHOB
IPVWY
ZCDJE
KLQGN
RSFMT

C > I -> B
B > H -> U
U > P -> D
D > D -> D
D > V -> H
H > B -> A
A > C -> S