Workbench
Five tools over one shared working text. The two solvers run for as long as you let them.
Tool 1 · The working text
The printed text is 395 digits. Everything downstream runs on what you set here.
Tool 2 · The square
Fill the grid and the plaintext below updates on every keystroke. Row and column labels are editable too — d'Agapeyeff warns on page 142 that neither the letters nor the coordinates are likely to be in any obvious order.
Tool 3 · Substitution solver
Hill-climbing over every assignment of the distinct units to letters, scored on English trigram statistics from a 148,000-letter corpus. Try the known-good control target and watch THEGENERALORDEREDTHESECOND… come out; then run it on the cipher and watch it fail to beat the cipher's own shuffle. That failure is evidence E5, reproducible here in seconds. This is a lighter model than the four-gram one behind Section 4, so it has its own scale: real English about −3.36, the best fit on this cipher −3.85, noise below −5.
Tool 4 · Transposition lab
Undo a transposition before the square gets to see the text. Keys may be a word — numbered by alphabetical rank exactly as on page 117, a convention checked against the author's own worked example — or a list of numbers. Choose whether the pieces being moved are whole two-digit units or single digits; the parity check tells you at once whether a digit-level key could ever have produced the printed pattern.
Or take an unkeyed route instead. All 614 of these were swept offline against a four-gram model and none of them reads; they are here so you can look at any one yourself. "Chinese manner" is the book's own geometry from page 126 — message written up and down the columns beginning on the right, read off by rows.
A digit-level key that reports broken cannot be the one d'Agapeyeff used, because his output would not have alternated. Unit-level keys always report intact — which is exactly why they remain the live hypothesis.
Tool 5 · Joint search — square and transposition together
The real attack, in miniature. It seeds the substitution from
unit frequencies (which a transposition cannot hide), builds the column order greedily from bigram
statistics and improves it by 2-opt, refines the substitution against the trigram model, and repeats
until neither improves — then perturbs and goes again. The offline version in
solver/ solves the column order exactly by dynamic programming and is
far stronger; this one is for exploring a specific width by hand.