-------------------------------------------------------------
|9 |8 |12 |4 | |18 |13 |25 |18 | |17 |19 |4 |18 |3 |
-------------------------------------------------------------
|16 |14 |4 |17 | |1 |25 |26 |2 | |2 |18 |1 |9 |18 |
-------------------------------------------------------------
|19 |4 |11 |19 | |9 |18 |2 |14 | |18 |3 |1 |4 |26 |
-------------------------------------------------------------
| | | |4 |22 |4 | | | |18 |24 |4 | | | |
-------------------------------------------------------------
|20 |8 |1 |26 |18 | |4 |26 |18 |9 | |17 |3 |8 |15 |
-------------------------------------------------------------
|18 |26 |4 | |3 |16 |26 |18 |20 |9 |4 | |18 |6 |4 |
-------------------------------------------------------------
|26 |4 |14 |8 | |20 |18 |3 |4 | |3 |8 |14 |4 |9 |
-------------------------------------------------------------
| | | |9 |4 |4 | | | |7 |25 |2 | | | |
-------------------------------------------------------------
|21 |18 |2 |14 |17 | |4 |24 |4 |4 | |4 |9 |18 |2 |
-------------------------------------------------------------
|18 |15 |4 | |17 |19 |26 |16 |23 |4 |17 | |18 |14 |8 |
-------------------------------------------------------------
|14 |8 |19 |4 | |4 |26 |2 |4 | |24 |18 |24 |4 |26 |
-------------------------------------------------------------
| | | |26 |18 |2 | | | |10 |18 |24 | | | |
-------------------------------------------------------------
|1 |8 |17 |8 |3 | |5 |18 |14 |4 | |24 |8 |4 |19 |
-------------------------------------------------------------
|4 |12 |18 |14 |4 | |18 |15 |18 |26 | |9 |16 |3 |4 |
-------------------------------------------------------------
|4 |18 |19 |4 |2 | |3 |18 |22 |8 | |4 |9 |17 |4 |
-------------------------------------------------------------
The following program reads in the html that's within the pre tags of the source, converts the integers to the corresponding letter of the alphabet and then shows the cypher text on the left side of a DOSBox-simulated DOS screen, and the plain text on the right, with hyphens in place of letters not yet decoded. It then accepts keystrokes in pairs: cyphertext then plaintext. All substitutions are made onto the plaintext grid.
Due to the ad hoc nature of the program, tests to assure against double assignments of letters were not included.
At the end, when the user is satisfied it looks correct, pressing ESC and then P, creates a file with the cypher text followed by the plaintext. This file follows the program listing.
DIM grid$(15, 15), grid2$(15, 15)
alpha$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
OPEN "codedc~1.txt" FOR INPUT AS #1
DO
LINE INPUT #1, l$
IF INSTR(l$, "|") THEN
row = row + 1: col = 0
DO
ix = INSTR(l$, "|")
ix2 = INSTR(ix + 1, l$, "|")
IF ix2 = 0 THEN EXIT DO
col = col + 1
ltrNo = VAL(MID$(l$, ix + 1, ix2 - ix1 - 1))
IF ltrNo > 0 THEN
grid$(row, col) = MID$(alpha$, ltrNo, 1)
ELSE
grid$(row, col) = " "
END IF
l$ = MID$(l$, ix2)
LOOP UNTIL LTRIM$(l$) = ""
END IF
LOOP UNTIL EOF(1)
DO
CLS
FOR row = 1 TO 15
FOR col = 1 TO 15
PRINT grid$(row, col); " ";
NEXT
PRINT
NEXT
FOR row = 1 TO 15
FOR col = 1 TO 15
LOCATE row, col * 2 + 48
IF grid$(row, col) <> " " AND grid2$(row, col) = "" THEN
PRINT "-"
ELSE
PRINT grid2$(row, col); " ";
END IF
NEXT
PRINT
NEXT
DO
a$ = INKEY$
LOOP UNTIL a$ > ""
IF a$ = CHR$(27) THEN EXIT DO
a$ = UCASE$(a$)
IF a$ >= "A" AND a$ <= "Z" THEN
DO
b$ = INKEY$
LOOP UNTIL b$ > ""
b$ = UCASE$(b$)
IF b$ >= "A" AND b$ <= "Z" OR b$ = " " THEN
FOR row = 1 TO 15
FOR col = 1 TO 15
IF grid$(row, col) = a$ THEN grid2$(row, col) = LTRIM$(b$)
NEXT
NEXT
END IF
END IF
LOOP
DO
a$ = INKEY$
LOOP UNTIL a$ = CHR$(27) OR UCASE$(a$) = "P"
IF UCASE$(a$) = "P" THEN
OPEN "codecros.txt" FOR OUTPUT AS #2
FOR row = 1 TO 15
FOR col = 1 TO 15
PRINT #2, grid$(row, col); " ";
NEXT
PRINT #2,
NEXT
PRINT #2,
FOR row = 1 TO 15
FOR col = 1 TO 15
IF grid$(row, col) <> " " AND grid2$(row, col) = "" THEN
PRINT #2, "- ";
ELSE
PRINT #2, RIGHT$(" " + grid2$(row, col) + " ", 2);
END IF
NEXT
PRINT #2,
NEXT
CLOSE
END IF
I H L D R M Y R Q S D R C
P N D Q A Y Z B B R A I R
S D K S I R B N R C A D Z
D V D R X D
T H A Z R D Z R I Q C H O
R Z D C P Z R T I D R F D
Z D N H T R C D C H N D I
I D D G Y B
U R B N Q D X D D D I R B
R O D Q S Z P W D Q R N H
N H S D D Z B D X R X D Z
Z R B J R X
A H Q H C E R N D X H D S
D L R N D R O R Z I P C D
D R S D B C R V H D I Q D
L O V E A Q U A S T E A M
I D E S B U R N N A B L A
T E X T L A N D A M B E R
E Y E A P E
C O B R A E R A L S M O G
A R E M I R A C L E A W E
R E D O C A M E M O D E L
L E E F U N
H A N D S E P E E E L A N
A G E S T R I K E S A D O
D O T E E R N E P A P E R
R A N Z A P
B O S O M J A D E P O E T
E V A D E A G A R L I M E
E A T E N M A Y O E L S E
Both NABLA and ERAL are a bit obscure, but it looks like the correct substitutions were made.
|
Posted by Charlie
on 2020-02-22 14:49:53 |