SI 413 Fall 2023 / Project


This is the archived website of SI 413 from the Fall 2023 semester. Feel free to browse around; you may also find more recent offerings at my teaching page.

Prolog

Created by French researchers in 1972. Prolog represents yet another major programming paradigm, logic programming. In this paradigm, programs are expressed as facts and rules, and a program is essentially a proof of a stated goal, using first-order predicate logic. This is a declarative language that lends itself to simple yet brilliant programs for many tasks, shifting most of the work from the programmer to the compiler or interpreter.

Useful Links

Tools

We will use the GNU prolog interpreter and compiler version 1.4.5.

Everything you need is already installed on CS department lab machines.

To install on your virtual machine, follow these steps:

  1. Run sudo apt install -y gprolog gprolog-doc
  2. That's it!

How I will run your code

You should probably use the interactive program gprolog in development. However, for testing your code, I will use the GNU Prolog compiler program gplc, as described below. In order for this to work, you must declare an initial goal, with a line of the form
:- initialization(INITIAL_GOAL_HERE).
For example, in the 99 bottles program linked above, this line would be
:- initialization(drink(beer,99)).
(Of course, the trailing period is crucially important.)

The programs you submit should be in a single file called proj.EXTENSION, for either part of the project. I will test your code by running the following commands using the software available in the lab environment or using the instructions above:

  gplc --no-top-level proj.pl
  ./proj

Phase 1 Requirements

For this language, you need to implement modifications B, D, and G. See the Phase 1 page for details on what this means.

Phase 2

See the Phase 2 Page for the list of suggested problems. Of the ones listed, I recommend the following as being most well-suited for Prolog:

  1. Make
  2. Game Scheduler
  3. Frequency count
  4. Find the missing digits
  5. ??? (you choose!)