I'm a high school student studying Prolog and am getting an error on a goal.
I have the following facts:
character(jim).
character(jenny).
character_type(jim, prince).
charcter_type(jenny, princess).
skill(fly).
skill(invisibility).
has_skill(jim, fly).
has_skill(jenny_invisibility).
pet(jim, horse).
pet(jenny, bird).
animal(horse).
animal(bird).
I would like to get all the pets of characters who are princesses. I am trying:
pet(character_type(_, princess), X).
Without successful results. Any help is appreciated.
pet(character_type(_, princess), X).fails because neither of the twopetfacts you have will unify with that term. They won't unify becausejimdoes not matchcharacter_type(_, princess)andjennydoes not matchcharacter_type(_, princess). - lurker