A brass and walnut rotor machine whose current you can follow through every wire.
A three-rotor cipher machine with a reflector and a plugboard, modeled exactly with the classic historical rotor wirings, notches and reflector table, and drawn in a three-quarter view where every deck, key, lamp and thumbwheel is painted through its own surface's affine map. Each key press first steps the rotors like an odometer, including the double step, when the middle rotor carries the left one and steps itself again. Then the schematic on the right traces the current: through the plugboard swap, through each rotor's wiring offset by how far it has turned, around the reflector, back through the rotors by a different route, and into a lamp. Since the reflector pairs letters, the machine is its own inverse and no letter ever encrypts to itself, and since the rotors move first, typing the same letter over and over lights a different lamp each time.
Try it. Type letters (or click the keys) to encrypt; Backspace undoes a letter and steps the rotors back. Press Enter or Reset to return the rotors to the key, then type the ciphertext to decrypt it. Click a rotor or its window letter to change the starting key (Shift-click goes back). Drag a plug to rewire the plugboard: drop it on another socket to make a new pair, or anywhere else to unplug it.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build an interactive three-rotor cipher machine with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Model the machine: three rotors with the classic historical wirings EKMFLGDQVZNTOWYHXUSPAIBRCJ, AJDKSIRUXBLHWTMCQGZNPYFVOE and BDFHJLCPRTXVZNYEIWGAKMUSQO (turnover notches Q, E and V), the reflector YRUHQSLDPXNGOKMIEBFZCWVJAT, and a plugboard of letter pairs.
- On each key press, step the rotors first: the right rotor always steps, the middle one steps when the right one passes its notch, and when the middle one sits on its own notch it steps again along with the left one (the double step).
- Send the letter through the plugboard, the three rotors (contact c maps to W[(c + pos) mod 26] - pos), the reflector, back through the rotors with the inverse wirings, and the plugboard again. Check that rotors at AAA with no plugs turn AAAAA into BDZGO.
- Draw a wiring diagram: one column of 26 contacts per stage, faint lines for every rotor's wiring, and the path of the current highlighted from the key to the lamp.
- Let the keyboard type letters and show the plaintext and ciphertext on a paper tape.
Once that works, make it beautiful:
- Animate the current flowing along its path, red on the way in and gold on the way back after the reflector.
- Let each rotor's column scroll its alphabet as it steps, with the top row as its window.
- Draw a keyboard and a lamp board in a warm brass style, and light the output lamp with a soft glow.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as drawing the machine in a three-quarter 3D view, dragging plug cables to rewire it, or a crib-based attack that recovers the rotor positions.