You must work independently on this test. This test is open book/ notes/ handouts/ computer, but you are not allowed to ask for outside help.
Submit your solutions in Canvas by Thursday, September 21, at 8:30 am. For problem 1, submit a text file called problem1.txt containing your answer. For problems 2 and 3, files problem2.txt and problem3.txt respectively are provided for you; they contain some starter code. Extend these two files with your own rules and then submit your final programs to Canvas.
- Write three (3) sentences to briefly explain what it means for a language to be compiled. Submit a text file called problem1.txt containing your answer.
- Write an Answer Set Prolog program to define the relation cousin(X, Y) X is a cousin of Y. Assume that the input for your program contains facts about the following relations:
- person(X) X is a person
- sex_of(X,S)thesexofXisS
- mother(X, Y) X is the mother of Y
- father(X, Y) X is the father of Y
- married(X, Y)
Use the starter code provided in the file problem2.txt and extend it with your own rules. The starter code includes facts describing the family captured by the family tree below:
Submit to Canvas the problem2.txt file extended with your solution. 3. Write an Answer Set Prolog program to solve the following problem:
There is a hotel that has n rooms available. A group of k people arrives and each person needs to be assigned a room. Your program must come up with different assignments of people to rooms.
Undergraduate students: Assume that all rooms are single rooms.
Use the starter code provided in the file problem3.txt and extend it with your own rules. Submit to Canvas the problem3.txt file extended with your solution.
Reviews
There are no reviews yet.