This Prolog program marks CM20214/221 2015/16 CW2: mark.pl (current version 1.03 22/2/2016)
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:
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.
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.
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 @)