## CM20214-20221—Marking CW2

This Prolog program marks CM20214/221 2015/16 CW2: mark.pl (current version 1.03 22/2/2016)

Instructions:

1. Put the file mark.pl in the same directory as your solution Prolog program, which we suppose is called abc12.pl (where abc12 stands for your BUCS id).
2. Run SWI-Prolog in that directory and do:

?- consult(mark).
?- mark('abc12.pl').

The result should be the grade for your solution and an explanation.

If Prolog loops or crashes, the most likely cause is the presence of an infinite number of answers. In that case a manual grading will be performed and marks will be subtracted as specified in the coursework specification.

Tip: if you want to check whether a query, say ?- s2(Q,100), admits multiple answers, just perform

?- findall(Q,s2(Q,100),L), length(L,N).

If the answer for N is different from 1 (including Prolog looping) then there are multiple answers.

This is an example run on a correct program with a good but not spectacular efficiency in finding the solutions:

?- mark('abc12.pl').
Task 1 is solved correctly and with no multiple answers.
Task 2 is solved correctly and with no multiple answers.
Task 3 is solved correctly and with no multiple answers.
Task 4 is solved correctly and with no multiple answers.
Task 4 requires 359701 inferences.
Task 5 is solved correctly and with no multiple answers.
Task 5 requires 78818869 inferences.
The grades for tasks 1 to 5 are: 20 + 20 + 20 + 7 + 5 = 72.
*** Found built-in not(.
Because of built-ins the grade is 72 - 20 = 52.
The penalty for multiple answers is 0.
The final grade is therefore 52.
The marker will inspect the program for soundness and fairness and might change the grade.
-id:abc12.pl-t4:359701-t5:78818869-BI:1-MG:52-
true.

The number of inferences might depend on the SWI-Prolog version and perhaps also on the platform, and this might justify small differences in grading. For the grading I will be using the latest SWI-Prolog version for the Mac.

Please note that I reserve the right to add other built-ins to the list contained in this program. In fact, the specification tells you exactly what you can use, all the rest you can't! There simply are too many possibilities for me to list them all in this program.

Further tips:

1. To run SWI-Prolog with more memory than the default, use something like

swipl -G32g -L32g

on the command line.
2. Use the following to get unabbreviated answers (for lists of quadruples especially):

?- set_prolog_flag(answer_write_options,[quoted(true), portray(true)]).

A final recommendation: please make sure that your program does not write anything to the display (in other words, don't use write/1 and similar and take care of all the warnings, such as for singleton variables). This is so that there is no interference with the marking program's output.

7.3.2016 Alessio Guglielmi email (replace AT by @)