Saturday, February 28, 2015

Spring Break Project: Enigma machine

You may remember that a while back, I went on an indefinite hiatus due to the pressures of balancing classwork, projects and professional stuff. In light of that trying time, I've convinced myself that I should attempt to pair my projects with my classwork where it's applicable in order to stay afloat. That being said, my next project in Programming Languages will be in Prolog. I've only seen a few samples of Prolog code in action, it seems to be driven largely by logic. Of course everyone says this, but I always thought every programming language was driven by logic! Anyways, the kind of logic Prolog operates on seems to be more like Syllogism in Philosophy. For example:
  • All men are mortal
  • Socrates is a man
  • Therefore Socrates is mortal.
 After a quick google search, I can see that this is also represented in Prolog, which the following:

  • All dogs are canines
  • All canines are mammals
?- deduction(all(dogs, canines), all(canines, mammals), C).
 
{C = some(mammals, dogs)}
{C = all(dogs, mammals)}
{C = some(dogs, mammals)}
  • Therefore: Some mammals are dogs, all dogs are mammals, and some dogs are mammals.
Nice.  So the next is, what do I think I'm going to do in this language? I was thinking about making an Enigma Machine in Prolog. Honestly, I'd rather write a program that generates Engima Machines (for an alphabet of any size, with any number of customized rotors, etc...) BUT, I don't want to get too ambitious. At the end of the day I'd rather be a guy who does more than he says. However, in light of my recent passion for Scheme/Racket, I think I might save the generator for that language. We'll see how it goes. I think the outline will look much like this:
  • Create a simple Enigma machine for 3 letters, then 4 (three rotors, odd and even reflector plates) in Racket.
  • Create an Enigma machine for all 26 letters of the alphabet in Racket. Then in Prolog.
  • Then, if time permits, work on an Enigma generator in Racket.

This way my assignment is covered, and I can also hone my functional programming skills some more. I'll be sure to update my github as I make progress.

No comments:

Post a Comment