Explanation
Input ▲ ● ■ ★
Four symbols go into a switch and come out in a new order. Which code did the switch use?
Codes look like four digits, for example three one four two.
Input ▲ ● ■ ★ → switch box → output ■ ▲ ★ ●
Code meaning
Here's how to read a code. The first digit says which input symbol comes out first.
The second digit says which comes out second, and so on.
Code meaning: digit in slot 1 = which input goes first
■ was input 3 · ▲ input 1 · ★ input 4 · ● input 2
So go through the output one symbol at a time and ask where it was in the input. Square was third, triangle first, star fourth, circle second.
The code is three one four two.
■ was input 3 · ▲ input 1 · ★ input 4 · ● input 2 → 3142
Apply a code
Applying a code works the same way. Code two four one three on A B C D: take input two, B; input four, D; input one, A; input three, C.
B D A C.
Apply a code: A B C D with 2413 → B D A C
Two switches
With two switches in a row, never try to do both at once. Apply the first, write down the middle row, then apply the second.
Two switches: apply the first, write the result, then the second
Worked example
Input P Q R S, output R P S Q. R was input 3, P input 1, S input 4, Q input 2 → code 3142.
Check by applying it: inputs 3, 1, 4, 2 = R, P, S, Q ✓.