Diogenes of Sinope was a Greek philosopher with a very colourful life story. Outside of his contributions to Cynicism and existentialism, he was also a logician. One of his more interesting inventions, derived seemingly on a whim, was a mechanism for translating digraphs into triglyphs.
• Simply put, he took a symbols from one alphabet, and devised a scheme for converting them into
combinations of members of another set of symbols
Through a combinatorial process, he determined a means of creating a codebook that could translate between the two. If Plato's accounts are to be believed, Diogenes intended them as a puzzle (similar to a crytogram). If
Plato was actually a pompous jerk who constantly misrepresented his contemporaries for self-aggrandizement, it was just a thought exercise. (Supposedly Plato solved it solely through logic, which is a spurious claim at best)
The one interesting thing about the codebook is that it used different numbers of triglyph symbols, depending on how many times the original digraphs showed up. (Since he was using carved stones, he might've just been
trying to do 'more with less')
For this assignment, you'll be treating his triglyphic translation as a form of encryption.
Since dealing with digraphs and actual triglyphs in Java would be tedious (and outside the scope of the course), we'll instead use ASCII text, and sequences of binary digits.
• For the sake of simplicity, we won't treat the binary as actual numbers: just patterns of 0s and 1s
Basic Requirements:
For this assignment you need to write two programs:
• A command-line tool that reads in text, creates a Diogenic codex/codebook, and creates an 'encrypted' text file (consisting of the codebook, followed by binary patterns)
• A command-line tool that accepts an encrypted text file, and extracts the codebook to restore the original text (saving it into another file)
And you need to create a document:
• Draw a diagram showing a Diogenic codex (tree), followed by its codebook (matchings), per below
Codebooks:
We'll start with the decryption first, because it's easier. Suppose we had the following codebook:
1100
! 1101
H 0111
a 000
c 0110
e 010
l 10
o 001
s 111
...and the accompanying encrypted message:
0111 010 10 10 001 1100 0110 10 000 111 111 1101
Then the final recovered message would be:
Hello class!
As you can see, the 'codebook' is just the matching between one type of symbol and another. (In this case, a character/string, to a binary pattern)
The Diogenic codex:
The codex itself isn't terribly complicated. It's basically just a tree that you traverse to see which sequence of alternate symbols to build up. e.g. (substituting _ for the space):
And so, to find the symbolic pattern for any letter, just follow it down the tree (0s for 'left paths', and 1s for 'right paths'). In this case, a c would mean 0110, and ! would mean 1101. The letter l, on the other hand, is 10.
Generating the Diogenic codex:
You might have noticed that some letters have shorter patterns than others. As hinted at earlier, Diogenes probably didn't want to use more stones than needed. So the symbols (letters) that occur the most frequently use the fewest glyphs.
You start by generating a frequency table:
Letter _ ! H a c e l o s
Freq. 1 1 1 1 1 1 3 1 2
Since l appears the most frequently, it needs the shortest path. Then s, and then whatever.
So what do we do? We actually make that tree! Specifically, we start with a forest of single-node-trees. Each node will have an attached label and frequency. (For a leaf node, the label's just the letter; for an internal node, it's the labels of all nodes within its subtrees)
You'll be devising something like a binary tree for this, though you'll need some extra code. So you start with the following trees:
Now, you pick the two trees with the lowest frequencies, merge them, and re-add them to the pool.
When the numbers are equal, it doesn't matter which you take, so I'll go with the space and exclamation mark:
Notice that the frequency of a node includes the sums of its subtrees. Let's go for c and H:
So long as we always pick the two trees with the lowest frequencies, it doesn't matter how else we decide. So next, we could pick ae, ao, or eo. Let's go with ao:
Now, we must pick e, but we can pick anything other than l for the other. Let's go with cH:
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of