Buy the book

PyGame

Python

ENIGMA

Explore the Enigma by creating a Python adventure game

Thanks to this book, you will be able to create an adventure game in Python on your own, while learning about the secret of Enigma. You will learn Python by writing successive code snippets. We place great emphasis on interdisciplinarity, showing that creating a game is not only about computer science, but also language, history, mathematics, art and music.

Game Plot

At the beginning we choose one of the three available characters: Henryk Zygalski, Jerzy Różycki or Marian Rejewski. After selecting a hero, we walk around the game universe moving to the right or left, or change the location using teleports. Our task is to find three rotors, the elements of the Enigma. After collecting all of them, we move to a room with an encryption machine to decipher the password there.

We have 5 locations:

I. French agent Hans-Thilo Schmidt (nicknamed "Asché") acquires plans to build Enigma machines around 1931. French intelligence, however, disregards this information and, considering it worthless, forwards it to the Poles.

II. Warsaw, the Saxon Square and the statue of Prince Józef Poniatowski (1763-1813). In the background there is the Saxon Palace, which from 1930 to 1937 was the seat of the Cipher Bureau. Here, in 1932, three Polish mathematicians: Marian Rejewski, Jerzy Różycki and Henryk Zygalski break the cipher of the German encryption machine – Enigma.

III. 1920, Polish-Bolshevik war. Lviv Skniłów Airport, Captain Merian Cooper's Albatros D.III aircraft ready to fly. Thanks to the messages broadcast by the Red Army, which are intercepted by the Polish radio station RKD, it becomes possible to break the "Revolution" cipher. This is done by Lieutenant Jan Kowalewski and Stefan Mazurkiewicz, a professor of mathematics.

IV. July 1939, Polish intelligence provides the British with valuable information on breaking the Enigma code. To achieve the level of work of Poles, the English would need five more years. They do not have that much time. Alan Turing, a mathematician, starts working in Bletchley Park, England. Using the achievements of Poles, he builds a cryptographic bomb. He succeeds just before the Battle of Britain begins.

V. The German submarine U-Boat (U-110) takes part in the Battle of the Atlantic. During the performing of the task is forced to surface by the British destroyers. Found inside the Enigma-M encryption machine is taken over by the English.

Go to the game!

ONLINE EDITOR

Both the entire game and the code of each chapter of Enigma can be viewed and run in the following online editor below without the need to install other tools. Just select the chapter you are interested in and click the ‘Go’ button.

Below we present individual chapters of Enigma, which explain the basic concepts of the Python language, allowing even beginners to write a simple game and explore the world of Python.


    
Ch00
Introduction and description of the game’s assumptions
Ch01
Basics, i.e. we get to know the environment and learn about Python variables
Ch02
Creating functions
Ch03
Classes, objects – importing, methods and properties
Ch04
Creating the first window with the background
Ch05
Advanced data structures – lists and dictionaries
Ch06
Animating characters – manipulating the values ​​of the properties of objects
Ch07
Adding teleport objects, additions – lists and dictionaries
Ch08
Three rotors in random rooms
Ch09
Decrypting messages using Enigma

GRAPHICS AND SOUND

Click the 'Download files' button. This will download one zipped file containing all the resources for the game: images, fonts, sounds and music. After unpacking the file, a directory tree will be created on the disk, containing all the mentioned graphic assets (images and fonts) and sound (music and sound special effects). In our online editor, all the resources are already imported, but if you want to use them for your exercises you can do it – just download the folder.

Download files