Enigma Milestone Demo Programs

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.

Milestone #0: The Enigma starter code

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:

Top view of the Enigma Machine

Milestone #1: Activate the keyboard

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:

Milestone #2: Connect the keys directly to the lamps

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:

Milestone #3: Design and implement the rotor data structure

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:

Milestone #4: Implement one stage in the encryption

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:

Milestone #5: Implement the full encryption path

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:

  1. Crossing the fast rotor from right to left (which you’ve already done)
  2. Crossing the medium rotor from right to left
  3. Crossing the slow rotor from right to left
  4. Looping through the reflector to reverse direction
  5. Crossing the slow rotor from left to right
  6. Crossing the medium rotor from left to right
  7. Crossing the fast rotor from left to right

After completing Milestone #5, your program should behave like this:

Milestone #6: Implement the rotor advance on pressing a key

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.

Extended Enigma demo

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.