CSCI.4430/6969 Programming Languages Spring 2013
Programming Assignment #1

This assignment is to be done either individually or in pairs. Do not show your code to any other group and do not look at any other group's code. Do not put your code in a public directory or otherwise make it public. However, you may get help from the TAs or the instructor. You are encouraged to use the RPILMS Discussions page to post problems so that other students can also answer/see the answers.

RPI Flu Epidemic

It is Flu season at RPI. Student Ashley has been infected and is avoiding contact with student Eric to ensure he does not get the Flu. However, Ashley is still going about her daily routine on campus and coming in contact with her friends. Every friend she converses with also gets the Flu. After acquiring the Flu, those students also give the Flu to every student they converse with. Assume the following students have conversations with the following friends:

The order in which these conversations took place is not known to us. Is Eric safe from the Flu? If not, how many possible infection paths are there from Ashley to Eric? Create a simple program in Prolog to print out all possible solutions. (Please note these are not group conversations. For example, when 'Ashley converses with John and Nate', she converses with John and Nate in separate conversations.)

Natural Language Processing with students in a line

For this problem, students labeled 'a' through 'f' are standing in a straight line. Create a Prolog program that allows the user to manipulate this line of students through natural language. A simple grammar can parse commands such as "Switch person a with person b." The parser then converts these sentences into simple commands. There is also the limitation that students may only switch with a student directly in front of them or behind them, as switching with students too far away will cause chaos in the line. After creating the command idiom for "switch X with Y", create the question idioms "Where is X in line?" which prints that student's position in line and "What is the current order of the line?" which prints out the line (ex: "a,c,b,d,e,f").

Some helpful code to make the parsing phase easier:

Extra Credit

Create a Natural Language interface for the 'Flu' problem. Enable the user to enter their own scenario (ex: "Ashley converses with Jon and Tim, Tim converses with Mike and Eric.") Create idiom to make someone sick, "X is sick." Also create question idioms "Can X get sick?", Which returns "Yes" if there is a possible path for X to get sick.

Due Date:
Received Time Grade Modification
before Monday, 02/11, 11:59PM +10%
before Tuesday, 02/12, 11:59PM no modification (on time)
before Wedneday, 02/13, 11:59PM -10%
before Friday, 02/15, 11:59PM -25%
after Saturday, 02/16, 12:00AM not accepted

Grading: The assignment will be graded mostly on correctness, but code clarity / readability will also be a factor (comment, comment, comment!).  See the professor or TAs, if you have ideas for other extensions for this assignment and would like extra credit for implementing them.

Submission Requirements: Please submit a ZIP file with your code, including a README file. In the README file, place the names of each group member (up to two). Your README file should also have a list of specific features / bugs in your solution. Your ZIP file should be named with your RPILMS user name(s) as the filename, either or Only submit one assignment per pair via RPILMS.