22.23 The murderer: Question

Exercise: The murderer

At the beginning, we saw that the murderer was someone who:

  • Had a motive. The motive could be either:
    • insanity,
    • money, or
    • jealousy.
  • Had access to perpetrating the crime. This involved both:
    • Having access to the weapon,
    • Having access to the key to the room, and
    • Being in the flat at the time of the crime.

We have codified all of this information, except for one last detail: That of saying that the murderer X is a person who had a motive and access to perpetrating the crime.

Write a Prolog rule which says this. Then use the rule to find out who the murderer is.

You will have to compile the program before asking the question that tells us who the murderer is. It may be that the Prolog system complains that there is a "syntax error". If so, go through the program and try to find out what was wrong. Then try to compile again.

Good luck!


Click to see an answer.

Prev: Relationships
Up: 22 A Murder Mystery
Next: 23 Blocksworld