mirror of
https://github.com/peter-tanner/CITS-3005-labs-knowledge-representation.git
synced 2024-11-30 14:20:18 +08:00
Lab 1
This commit is contained in:
commit
10237b7386
5
README.md
Normal file
5
README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# CITS3007 labs
|
||||||
|
|
||||||
|
All labs are not assessed and are freely available online, therefore this does not constitute misconduct.
|
||||||
|
|
||||||
|
https://teaching.csse.uwa.edu.au/units/CITS3005/
|
3
hello_world.pl
Normal file
3
hello_world.pl
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
main :- write('hello world').
|
||||||
|
# run file with
|
||||||
|
# [hello_world], main.
|
33
lab1-logic-programming.pl
Normal file
33
lab1-logic-programming.pl
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
% Lab 1 - logic programming
|
||||||
|
% LABSHEET:
|
||||||
|
% https://teaching.csse.uwa.edu.au/units/CITS3005/labs/lab01-logic-programming.pdf
|
||||||
|
|
||||||
|
student(jane).
|
||||||
|
student(tim).
|
||||||
|
student(cris).
|
||||||
|
|
||||||
|
unit(cits3005).
|
||||||
|
unit(cits2211).
|
||||||
|
|
||||||
|
prerequisite(cits2211,cits3005).
|
||||||
|
|
||||||
|
mark(cits3005,jane,Result) :- Result is 50.
|
||||||
|
mark(cits2211,jane,Result) :- Result is 57.
|
||||||
|
|
||||||
|
mark(cits2211,tim,Result) :- Result is 30.
|
||||||
|
|
||||||
|
mark(cits2211,cris,Result) :- Result is 60.
|
||||||
|
|
||||||
|
eligible(Student,Unit) :-
|
||||||
|
student(Student),
|
||||||
|
unit(Unit),
|
||||||
|
(
|
||||||
|
% CASE 1: Unit has no prerequisites
|
||||||
|
\+ prerequisite(_, Unit),
|
||||||
|
!;
|
||||||
|
|
||||||
|
% CASE 2: Unit has prerequisites AND Student's mark in the prerequisite unit >= 50
|
||||||
|
prerequisite(PreUnit,Unit),
|
||||||
|
mark(PreUnit,Student,Result),
|
||||||
|
Result >= 50
|
||||||
|
).
|
Loading…
Reference in New Issue
Block a user