Cryptoquotes

Type
Game
Category
Cryptogram puzzle helper
Author
Mike Fleischmann
Published in
Antic, July 1985 (Vol. 4, No. 3)
Year
1985
Language
Atari BASIC
Requirements
Any Atari 8-bit computer, any memory size, Atari BASIC; disk or cassette
Cryptoquotes screen: an encoded quote in inverse letters, the unused-letter alphabet below, and instructions

About the program

Lots of newspapers ran a daily cryptoquote: a saying in which every letter has been swapped for another. If THAT appears as WFRW, then W stands for T, F for H and R for A. You crack it by guessing words and then writing each guessed letter above every copy of its code letter, which uses up a lot of paper and eraser.

Mike Fleischmann was a cryptoquote fan, and in Antic's July 1985 issue he offered this short BASIC program as an "automatic blackboard". You type in the puzzle once. After that, each guess you make is written above every matching code letter at the same moment, and a guess can be wiped out just as easily. Fleischmann was a programmer and digital design engineer from Utah, and he also wrote the listing printout program that Antic was using at the time.

Typing it in

The listing has a few inverse-video strings: {inv} … {/inv} means press the Atari (inverse) key, type the text, then press the key again. In line 250 and line 3080 the whole alphabet is inverse. {BELL} in lines 200 and 344 is the buzzer character: press ESC, then CTRL-2. The magazine printed a TYPO II checksum beside each line. This listing comes from the magazine disk, so it doesn't have them, and you shouldn't type them in any case.

How to use it

  1. RUN it and type the puzzle in upper case (spaces are fine, but punctuation is rejected). If it's longer than one input line, type the rest at the second prompt. Otherwise just press RETURN.
  2. The puzzle appears in inverse letters on the even screen rows, with a blank row above each one for your guesses. A row of inverse letters underneath shows the plain letters you haven't used yet.
  3. Type a code letter, a space and your guess, for example W S, then press RETURN. Every W gets an S written above it.
  4. To take a guess back, type just the code letter. # clears all guesses, @ starts a new puzzle and % quits.

Fleischmann ended the article with a puzzle of his own (the hint was that Y stands for T):

WXXA KGZO! BRJ JXG ERDQ BRFJ ERUUJ EXGCN NXKDTFW YEQNQ UGLLKQN.-YEQ RGYEXC

How it works

  • The whole puzzle is held in one string, and line 220 adds 128 to every character code to make it inverse. A second 320-character string, B$, holds the guesses at the same positions.
  • The subroutine at 10090 finds up to four word breaks, looking back from column 38 for a space so that no word is split. The two print routines at 1050 and 2050 use those break points.
  • Line 3060 handles a guess by copying the plain letter into B$ wherever the code letter appears. Lines 3080–3100 then rebuild the alphabet line and blank out each letter that has been used.

Variations to try

Fleischmann suggested several. Warn when a plain letter has already been used, accept whole words as guesses, copy punctuation onto the answer line, make the program faster, or count your moves so that you can try to solve a puzzle in as few as possible.

Listing

10 REM CRYPTO QUOTES
20 REM BY MIKE FLEISCHMANN
30 REM (c) 1985, ANTIC PUBLISHING
90 DIM A$(320),B$(320),CH1$(3),CH2$(1),ALPH$(26),C$(320)
100 GRAPHICS 0:? ,"{inv} CRYPTO QUOTES {/inv}":?
105 ? "INPUT YOUR STRING:"
110 INPUT A$
140 REM If your string is too long for A$, continue it in B$, below.
160 ? :? "INPUT THE REST OF YOUR STRING":? " or press [RETURN]."
170 INPUT B$:IF LEN(B$)<1 THEN C$=A$:GOTO 190
180 C$(1,LEN(A$))=A$:C$(LEN(A$)+1,LEN(A$)+1)=" ":C$(LEN(A$)+2)=B$:A$=C$
190 FOR I=1 TO LEN(C$):KK=ASC(C$(I,I)):IF KK=32 THEN 210
200 IF KK<65 OR KK>90 THEN POP :POSITION 7,10:? "{BELL}{inv} UPPER CASE LETTERS ONLY!{/inv}";:FOR KK=1 TO 300:NEXT KK:GOTO 10
210 NEXT I
220 FOR I=1 TO LEN(C$):C$(I,I)=CHR$(ASC(C$(I,I))+128):NEXT I
230 FOR I=1 TO 320:B$(I)=" ":NEXT I
240 GRAPHICS 0:? ,"{inv} CRYPTO QUOTES {/inv}":GOSUB 10090:REM FIGURE OUT STRING BREAK POSITIONS
250 ALPH$="{inv}ABCDEFGHIJKLMNOPQRSTUVWXYZ{/inv}"
260 GOSUB 1050:REM PRINT CRYPTO STRING
270 GOSUB 2050:REM PRINT REPLACEMENT STRING
280 POSITION 6,10:? ALPH$:? :? "  Type in the letter you want to "
290 ? " change and then the letter you "
300 ? " think it should be."
305 ? :? "(For example, typing  W S  changes all W's to S's.)"
310 ? :? " IF W= # GUESSES WILL BE ERASED"
320 ? " IF W= @ START OVER"
330 ? " IF W= % END PROGRAM":PRINT "                      ":POSITION 3,22
340 INPUT CH1$:IF LEN(CH1$)<1 THEN 240
341 FOR X=1 TO LEN(CH1$):KK=ASC(CH1$(X,X))
342 IF (KK>64 AND KK<91) THEN 348
343 IF KK=32 OR KK=35 OR KK=37 OR KK=64 THEN 348
344 POP :POSITION 7,6:? "{BELL}{inv} UPPERCASE LETTERS ONLY!{/inv}";:FOR KK=1 TO 150:NEXT KK
347 GOTO 240
348 NEXT X
350 IF CH1$="#" THEN 230
360 IF CH1$="@" THEN A$="":GOTO 100
370 IF CH1$="%" THEN 420
380 IF LEN(CH1$)<3 THEN CH2$=" ":CH1$=CH1$(1,1):GOTO 400
390 CH2$=CH1$(3,3):CH1$=CH1$(1,1)
400 GOSUB 3060
410 GOTO 270
420 GRAPHICS 0:END
1050 POSITION 1,2:FOR I=1 TO BPT1:PRINT C$(I,I);:NEXT I
1060 IF BPT2=0 THEN RETURN
1070 POSITION 1,4:FOR I=BPT1+1 TO BPT2:PRINT C$(I,I);:NEXT I
1080 IF BPT3=0 THEN RETURN
1090 POSITION 1,6:FOR I=BPT2+1 TO BPT3:PRINT C$(I,I);:NEXT I
1100 IF BPT4=0 THEN RETURN
1110 POSITION 1,8:FOR I=BPT3+1 TO BPT4:PRINT C$(I,I);:NEXT I
1120 RETURN
2050 POSITION 1,1:FOR I=1 TO BPT1:PRINT B$(I,I);:NEXT I
2060 IF BPT2=0 THEN RETURN
2070 POSITION 1,3:FOR I=BPT1+1 TO BPT2:PRINT B$(I,I);:NEXT I
2080 IF BPT3=0 THEN RETURN
2090 POSITION 1,5:FOR I=BPT2+1 TO BPT3:PRINT B$(I,I);:NEXT I
2100 IF BPT4=0 THEN RETURN
2110 POSITION 1,7:FOR I=BPT3+1 TO BPT4:PRINT B$(I,I);:NEXT I
2120 PRINT " "
2130 RETURN
3020 REM SEARCH CRYPTO AND PUT GUESS IN REPLACEMENT STRING, UPDATE ALPHA$
3060 FOR I=1 TO LEN(A$):IF CH1$=A$(I,I) THEN B$(I,I)=CH2$
3070 NEXT I
3080 ALPH$="{inv}ABCDEFGHIJKLMNOPQRSTUVWXYZ{/inv}"
3090 FOR I=1 TO LEN(A$):CH1$=B$(I,I):IF CH1$<>" " THEN T=ASC(CH1$)-ASC("A")+1:ALPH$(T,T)=" "
3100 NEXT I
3110 RETURN
10090 BPT1=0:BPT2=0:BPT3=0:BPT4=0:REM BPTn IS THE BREAK POINT FOR EACH LINE
10100 IF LEN(A$)<38 THEN BPT1=LEN(A$):RETURN :REM CHECK FOR A$ LESS THAN 1 LINE LONG
10110 FOR I=38 TO 20 STEP -1:IF A$(I,I)=" " THEN 10130
10120 NEXT I
10130 BPT1=I
10140 IF LEN(A$)<BPT1+38 THEN BPT2=LEN(A$):RETURN
10150 FOR I=BPT1+38 TO BPT1+20 STEP -1:IF A$(I,I)=" " THEN 10170
10160 NEXT I
10170 BPT2=I
10180 IF LEN(A$)<BPT2+38 THEN BPT3=LEN(A$):RETURN
10190 FOR I=BPT2+38 TO BPT2+20 STEP -1:IF A$(I,I)=" " THEN 10210
10200 NEXT I
10210 BPT3=I
10220 IF LEN(A$)<BPT3+38 THEN BPT4=LEN(A$):RETURN
10230 FOR I=BPT3+38 TO BPT3+20 STEP -1:IF A$(I,I)=" " THEN 10250
10240 NEXT I
10250 BPT4=I
10260 RETURN

Download

The original program from the Antic disk, to LOAD or ENTER instead of typing it: CRYPTO.BAS.

Credits