Predicates
is_a(X,Y) X is a doctor/handyman
drives(X,Y) X drives Y
We are given that a doctor drives a sportscar and a handyman drives a 4WD
is_a(john,doctor).
is_a(david,handyman).
Now i want the code decide what kind of car john/david are driving. I tried doing:
drives(X,sportscar) :- is_a(X,doctor).
drives(Y,4WD) :- is_a(Y,handyman).
What am i doing wrong?
?- drives(john,fourwd).
true .
?- drives(john,sportscar).
true .
?- drives(david,fourwd).
true .
?- drives(david,sportscar).
true .