I am new to prolog and I am trying to solve this puzzle problem. I did a couple tutorials on youtube on the basics of prolog, but I need some help solving the puzzle below.
Two weeks ago, four enthusiasts made sightings of objects in the sky in their neighborhood. Each of the four reported his or her sightings on a different day. The FBI came and was able to give each person a different explanation of what he or she had "really" seen. Can you determine the day ( Tuesday through Friday ) each person sighted the object, as well as the object that it turned out to be?
- Mr. K made his sighting at some point earlier in the week than the one who saw the balloon, but at some point later in the week, than the one who spotted the Kite ( who isn't Ms. G ).
- Friday's sighting was made by either Ms. Barn or the one who saw a plane ( or both ).
- Mr. Nik did not make his sighting on Tuesday.
- Mr. K isn't the one whose object turned out to be a telephone pole.
I have my set my rules up correctly, but I can't seem to get the logic down pack. I am looking for guidance not direct answers. On the far right, I have listed the number to each question i am attempting to answer
enthu(mr_k).
enthu(ms_barn).
enthu(ms_g).
enthu(mr_nik).
object(ballon).
object(kite).
object(plane).
object(tele_pole).
day(tuesday).
day(wednesday).
day(thursday).
day(friday).
sight(X,ballon).
sighting(mr_k):- 1
day(X),
sight(X,Y),
didntc_kite(ms_g).
friday_sight:- enthu(ms_barn); 2
saw(X,plane);
both(ms_barn,X).
nosight_tuesday(mr_nik,X). 3
no_telepole(mr_k,Y). 4
mr_klien
and notmr_k
that you fist declared ? – Searchingsighting
as the the action/object of interest.. e.g instead of sayingnosight_tuesday(mr_nik,X).
. build the rule that made sightingtrue
ikesighting(mr_nik) :- ...
sighting(mr_k) :- ...
so on – Searching