Encode/decode it.



One of the first uses of computers was to encode messages such as with the enigma. Also used was the Navajo indian codetalkers to naturally send and receive messages so that the enemy could not decipher them. Even kids have used pig-latin to send secret messages. You do not have to get that compilcated though. Do not know morse code, then let the computer do the translation for you. You could use a program like codeit.





and then go to the morse code option:




If you have source file named test with:

This is a test.

Then the conversion to test.out might be:

 -  ....  ..  ...   ..  ...   .-   -  .  ...  -  .-.-.-

One thing to notice is that there is not differentiation between upper and lower case letters.  To do a program like this, you will want to set up a translation table. In fact, you could use any set of characters for your own secret code.

    SELECT CASE UCASE$(Character$)
            CASE "A"
                morsedat$ = ".-"
            CASE "B"
                morsedat$ = "-..."
            CASE "C"
                morsedat$ = "-.-."
            CASE "D"
                morsedat$ = "-.."
            CASE "E"
                morsedat$ = "."
            CASE "F"
                morsedat$ = "..-."
            CASE "G"
                morsedat$ = "--."
            CASE "H"
                morsedat$ = "...."
            CASE "I"
                morsedat$ = ".."
            CASE "J"
                morsedat$ = ".---"
            CASE "K"
                morsedat$ = "-.-"
            CASE "L"
                morsedat$ = ".-.."
            CASE "M"
                morsedat$ = "--"
            CASE "N"
                morsedat$ = "-."
            CASE "O"
                morsedat$ = "---"
            CASE "P"
                morsedat$ = ".--."
            CASE "Q"
                morsedat$ = "--.-"
            CASE "R"
                morsedat$ = ".-."
            CASE "S"
                morsedat$ = "..."
            CASE "T"
                morsedat$ = "-"
            CASE "U"
                morsedat$ = "..-"
            CASE "V"
                morsedat$ = "...-"
            CASE "W"
                morsedat$ = ".--"
            CASE "X"
                morsedat$ = "-..-"
            CASE "Y"
                morsedat$ = "-.--"
            CASE "Z"
                morsedat$ = "--.."
            CASE "1"
                morsedat$ = ".----"
            CASE "2"
                morsedat$ = "..---"
            CASE "3"
                morsedat$ = "...--"
            CASE "4"
                morsedat$ = "....-"
            CASE "5"
                morsedat$ = "....."
            CASE "6"
                morsedat$ = "-...."
            CASE "7"
                morsedat$ = "--..."
            CASE "8"
                morsedat$ = "---.."
            CASE "9"
                morsedat$ = "----."
            CASE "0"
                morsedat$ = "-----"
            CASE "."
                morsedat$ = ".-.-.-"
            CASE "?"
                morsedat$ = "..--.."
            CASE ","
                morsedat$ = "--..--"
            CASE "-"
                morsedat$ = "-...-"
            CASE "/"
                morsedat$ = "-..-."
            CASE " "
                morsedat$ = " "
            CASE Backspace$, CHR$(29)
                morsedat$ = "...-.-"
            CASE Escape$
                morsedat$ = ".-.-."
            CASE Quote$, CHR$(39)
                morsedat$ = ".-..-."
            CASE ":"
                morsedat$ = "---..."
            CASE ";"
                morsedat$ = "-.-.-."
            CASE "(", ")"
                morsedat$ = "-.--.-"
            CASE "+", "&"
                morsedat$ = ".-..."
            CASE ELSE
                morsedat$ = " "
        END SELECT

If you really wanted to get complicated, you could go through several translations.

Comments

Popular posts from this blog

Guiless?

Web.com and Network Solutions, the Walmart of the internet.

MSOffice vs Libreoffice