22.11 Motive: Question

Exercise: Motive

Sherlock Holmes has determined that the motive is either:

  • insanity
  • poverty, or
  • jealousy

First, write a Prolog fact which says that the victim is Anna.

Then write a Prolog predicate which says that a person X has a motive if that person either is insane, is poor, or is jealous of the victim. Use three Prolog rules for this.

Assume that you have a Prolog predicate called 'jealous(X,Y)' which tells us whether X is jealous of Y (we will write this later). Assume also that you have a predicate 'insane(X)' and a predicate 'poor(X)' which tell us whether X is insane or poor.

Answer

Click to see an answer.


Prev: Who is where when
Up: 22 A Murder Mystery
Next: Insanity