This web page animates the solutions to each of the milestones in the Enigma project. A detailed strategy for implementing each of the milestones appears in the project assignment handout.
Your starting point for this project consists of the complete
implementation of EnigmaView
along with a stub implementation
of EnigmaModel
that does nothing more than set up the
connection between the model and the view.
Running the initial version produces the following image, which is
completely inert and does not respond to any mouse actions:
Your job in Milestone #1 is to make the keyboard active so that
pressing the mouse down on a key changes its state to “down”
and then updates the view.
The view then calls the is_key_down
method in your model and changes the color
of the key letter.
The Milestone #1 application looks like this:
Your job in Milestone #2 is to implement the methods in the model
that control the lamps and then change the key_pressed
method so that it sets the state of the
corresponding lamp to “on” without any encryption.
The Milestone #2 application looks like this:
For this milestone, your first task is to design and implement a new
EnigmaRotor
class that encapsulates the information
required to represent the state of one of the Enigma rotors.
After initializing these structures, you then have to implement the
rotor_clicked
method so that it
calls the advance
method.
This change allows the user to change the day settings by clicking on
the rotor displays at the top of the window:
Your next task is to implement the first stage in the encryption path, which occurs when the signal from the key passes through the fast rotor from right to left. You should check to make sure that your code lights the same lamps when you press a key as this demo application:
Your task here is to expand on the idea from Milestone #4 to trace the encryption through all seven stages implemented by the Enigma machine:
After completing Milestone #5, your program should behave like this:
The final step consists of adding code to the key_pressed
method so that pressing the key causes
the fast rotor to advance by one position.
You also have to implement the “carry” feature so that when
a rotor cycles from Z back to
A, the rotor to its left (if any)
advances.
Implementing Milestone #6 gives you a completely working Enigma simulator that works like this:
Congratulations! You’re done.
The following demo program is not part of the project assignment but may give you more of an idea how the Enigma works internally. In this demo, clicking on either of the two thumbscrews marked with red circles opens up the Enigma machine cover so that you can see a schematic of the rotor operation. This demo also allows you to select any of the five Enigma rotors and arrange them in any order, just as the Enigma operators did in World War II.