CS 191 Prolog Assignment 1

Assigned: 22 March 2023   Due: 3 April 2023

These programming problems can be done individually or in pairs. If you do work with another student, please hand in one copy of the assignment with both names clearly indicated. Make sure that you actually work together on the assignment if you go this route.

Your assignment is to work through the experiments with Simple Ciphers from Section 6.3 of Hein's online Prolog Lab Book, starting on page 73. You are going to produce three different cipher algorithms, so rather than calling them all cipher, I want you to give them different names.

  1. Additive cipher. This one is mostly done for you, but rather than calling it cipher, please call it additive.
  2. Multiplicative cipher. Call this one multiplicative. Be sure to address the questions in part b, writing a loop to test and report the number of distinct letters for each possible key from 1 to 26. You can ignore most of part c of this experiment, but you should address the issue of fixed points, that is, values that map to themselves.
  3. Affine cipher. Call this one affine and try to address the questions.

You should submit your Prolog file using Blackboard. There is a Prolog Submission page that has a link for submitting your Prolog Assignment 1. Be sure to use comments to explain what your code is doing. Recall that Prolog treats anything between /* and */ as a comment, as well as anything after a % on a line.