The Straddling Checkerboard is a method for converting letters to numbers and was part of a pencil an paper cipher known as VIC
To convert letters to numbers first you have to make a checkboard like this:
0 1 2 3 4 5 6 7 8 9
---------------------------------------
E T A O N R I S
2 | B C D F G H J K L M
6 | P Q # U V W X Y Z .
Is a 10 x 3 table filled with 28 different simbols and two blanks on the first row.
The labels of second and third row are the position of the blanks on the first one.
To cipher a message you have to replace each letter with the column label. If it is not on the first row, prepend row label:
G -> 24
O -> 4
L -> 28
F -> 23
The extra simbols #
and .
are used to escape numbers and to indicate full-stop.
Task
Input:
- 0 to 26 unsorted unique letters (key)
- 4 digits, #1 != #2 and #3 != #4
- Alphanumeric message to be encoded
Output:
- Digits representing the encoded message
Implementation:
The table will be filled with the 26 character recived by input. If lengh is less than 26, the remaining spaces will be filled with the missing letters in alphabetical order.
The first two integers represent the blank spaces on the first row (and labels for second and third row).Next two integers represent the position of #
and .
on the third row.
Example:
Input: codeglf , 4 6 8 9 , "programming puzzles are gr8."
Yields this table:
0 1 2 3 4 5 6 7 8 9 ------------------- c o d e g l f a 4| b h i j k m n p q r 6| s t u v w x y z # .
Output: 47491549945454246547727777637094935496886869
Note1: Spaces are not encoded and not included in the output.
Note2: Original message may contain letters, numbers, spaces and . (assume same capitalisation as the key)
Note3: If there is a number in the original message you have to output the corresponding code number for #
followed by the number then another #
code (68 in the example) and then continue with the letters.
Example2:
Input: toearly , 2 8 6 1 , "wake up at 06.am"
0 1 2 3 4 5 6 7 8 9 ------------------- t o e a r l y b 2| c d f g h i j k m n 8| p . q s u v # w x z w a k e u p a t # 0 6 # . a m 87 4 27 3 84 80 4 0 86 0 6 86 81 4 28
Output: 87427384804086068681428
This is the complete VIC cipher question.
gr
before the8
from your output, if I'm reading it right. \$\endgroup\$4 7 8 9
but the last half uses4 6 8 9
. \$\endgroup\$