Cryptoquote — Use Your ZX80 to Help You Solve Substitution Ciphers

Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v1 n1 (Volume 1, Issue 1)
Date: November 1980
Pages: 2

“Cryptoquote” is a program for infinitely patient or just masochistic puzzle-solvers. It works just like cryptoquotes in newspapers–you substitute letters for letters to decode the babble into a quotation. Your ZX80 will help you, though, by displaying the frequency distribution of letters in your quotation. To help you more, here’s the order of most commonly used letters in the English language:

ETAONRISHDLFCMUGYPWBVKXJQZ.

Run the program, then answer command with F NEWLINE (NL) to see frequency, X=L NL to substitute L for X, NL BREAK (quickly) to stop.

To change the quotation, modify line 990 to contain the new cryptoquote (find new ones in your newspaper or a puzzle book).

This program just fits in the 1K RAM. Don’t choose quotations much longer than the one in line 990. Otherwise, the display will shrink as you add characters. This listing is identical to the ZX80 screen. In line 990 JQYGZKZ is one word, as is JQPMBKBQPX. We would welcome ideas for shortening or adding features to Cryptoquote.

   6 DIM T(25)
7 LET K=1000
60 FOR X=0 TO 25
65 LET T(X)=220
70 NEXT X
100 CLS
110 GO SUB 990
120 PRINT T$
123 LET X=CODE(T$)
125 IF X<38 OR X>63 THEN GO TO 170
130 PRINT CHR$(T(X-38));
140 LET T$=TL$(T$)
160 GO TO 123
170 IF X=1 THEN GO TO 200
175 PRINT CHR$(X);
180 GO TO 140
200 PRINT
205 PRINT "COMMAND:";
210 INPUT F$
220 IF CODE(TL$(F$))=227 THEN LET T(CODE(F$)-38)=CODE(TL$(TL$(F$)))
222 IF F$="F" THEN GO TO 400
240 GO TO 100
400 CLS
410 GO SUB 990
460 LET N=CODE(T$)-38
470 IF N=-37 THEN GO TO 500
480 IF N<0 OR N>25 THEN GO TO 485
483 LET T(N)=T(N) + K
485 LET T$=TL$(T$)
490 GO TO 460
500 FOR X=0 TO 12
505 LET S=T(X)-(T(X)/K)*K
506 LET S2=T(X+13)-(T(X+13)/K)*K
510 PRINT CHR$(X+38);"(";CHR$(S);"):";T(X)/K;" ";CHR$(X+51);"(";CHR$(S2);"):";T(X+13)/K
520 LET T(X)=S
525 LET T(X+13)=S2
530 NEXT X
540 GO TO 200
990 LET T$="UVQ JVQQXZX KQ JQYGZKZ UBKV YWJVBPZX WJJZGKX KVZ JQPMBKBQPX QC XFWDZLH"
999 RETURN
SYNTACTIC SUM = -1796

P.S. Answer to this one will appear next issue.


SPECIAL HANDLING

Most of you know about the number in Boston for technical information (617/367-2555, 9-5 EST) at Sinclair Research. Now SYNTAX subscribers can get special treatment from Sinclair if you write in with requests, problems, or comments. Just write “SYNTAX ZX80” in the bottom left corner of the envelope. Nigel Searle promised us that these letters would receive immediate attention. Send letters to:

Sinclair Research Limited
50 Staniford Street
Boston, MA 02114

Do not write to the Yalesville, CT, warehouse address.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.