What’s a Code?
Download
Report
Transcript What’s a Code?
What’s a Code?
1. A system of signals used to represent
letters and numbers in transmitting
messages.
2. A system of symbols, letters, or words
given certain arbitrary meanings, used
for transmitting messages requiring
secrecy and brevity.
-- American Heritage Dictionary
Who are these people?
Sending messages using
Clicks and Clacks:
Telegraph Key
Western Electric Morse Code
Telegraph Sounder
How does this work?
When a current flows through the
induction coil, the resulting magnetic field
attracts an armature that is held up against
a metal arm. When the current is switched
off, the armature is drops to its resting
position, resulting in a "click". When the
current returns, the armature is raised
back to the upper arm resulting in a
"clack." http://www.answers.com
What can you do with
“Clicks” and “Clacks”?
Morse Code:
A fast click-clack is a dot.
A slow click-clack is a
dash.
Morse code is comprised
on only two symbols.
Morse code is a binary
code (two symbols).
Famous Morse Codes
SOS – An easy to remember distress call,
similar to 911 today.
SOS = . . . _ _ _ . . .
‘V’ for Victory – Beethoven’s 5th Symphony
Dah Dah Dah Daaahhhmmmm = . . . _
Samuel Morse
Artist/Inventor
1830’s
Note not all
letters have
the same
length code
Not all codes are the same length:
Number of Dots and/or
Dashes (length of code)
1
Number of Possible
Codes
21 = 2
2
22 = 4
3
23 = 8
4
24 = 16
Reasons for using codes
of varying lengths
• Most commonly occurring characters
are given short codes
• This is a form of file compression
Frequency Table for the English Language
Spies can break simple codes that replace each letter with
another symbol – just by counting the frequency of the symbols.
Zip File Compression
• Eliminate
Redundancy
• Replace common
words with short
codes.
• A table is created
indicating short
codes for common
words.
More Binary Coding Schemes:
• Braille uses raised or
flat dots with six dot
locations.
• 26 or 64 unique
codes are possible.
Braille
Translating Braille
What about the humans?
We have ten fingers…
Therefore we tend to use ten symbols
for constructing numbers:
0123456789
Our numbering System is Arabic
Indo-Arabic – of Indian
1. Positional - number
Origin, introduced into the
depends on digit’s
west around 1000 A.D.
position.
2. No Special symbol
for the number ten.
Hindu Numerals from 100 A. D.
3. Need for ZERO
How many apples are:
3,674.5
(in base-10)
This is:
3 X 103 + 6 X 102 + 7 X 101 + 4 X 100 + 5 X 10-1
3000 X 600 + 70 + 4 + 5/10
How many apples are:
3,524.5 if you happen
to be a bird with six digits?
(base-6)
This is:
3 X 63 + 5 X 62 + 2 X 61 + 4 X 60
+ 5 X 6-1
= 3*216 X 5*36 + 12 + 4 + 5/6
= 648 + 180 + 12 + 4 + 5/6 = 844.83
The Mayans used a base-20
numbering system
Computers have tiny electrical switches (transistors)
that are controlled by two voltages
0000
0
0001
1
0010
2
0011
3
0100
4
0101
5
0110
6
0111
7
1000
8
1001
9
1010
A
1011
B
1100
C
1101
D
1110
E
1111
F
• 28 = 256
• 216 = 65,536
• 232 = 4,294,967,296
A 32-bit microprocessor can access
4 billion memory addresses – or
4GBytes
Be a secret agent!
• Using tic-tacs of multiple colors, devise a
coding scheme for coding a sentence of
about 15-20 characters.
• A sentence may have numbers and
letters.
• Determine how you will transport this
code.
• Keep codes as small as possible.
• Can you memorize your codes?
Competition
• Half of your team will code the message.
• One person will transport the code to
another room.
• The other half of the team will decode the
first message and code a response.
• The first team to decode the 2nd message
has to eat all the tic-tacs!
How to construct numbers:
The Roman Way
I - one
V - five
X – ten
L - fifty
C - 100 (cento in Italian)
D – 500 (diecicento)
M – 1000 (mille)
• 1945 = MCMXLV
or MCMXXXXV ?
or MCMVL ?
• 1907 = MCMVII
• 1909 = MCMIX
Cumbersome to add,
confusing to subtract.
Very hard to multiply
and divide.