Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How: member-x in a list is also member-y

Status
Not open for further replies.

Shizuka7

Programmer
May 16, 2013
2
PT
Hello! I am new here in the forum, and I also a noob in programming Prolog, so if you could help me, I would very much appreciate it :)
How can I write in Prolog the following: that a member of a list, let's say, member1 is also member2 or member3, but not both of them?

Thank you very much!
Shizuka
 
That's not very clear !
What do you mean by member1 is also member2 ?
Can you give an example with a list !
 
Thank you for answering.
I am doing a "game" in which I have six suspects with different traits:

suspect(Name, Age, Weapon, Shape, Object, Shoes)
The goal is to implement a series of clues so that the program says which the different traits of all the six suspects. For example:

suspect(Valdemort,150,winchester,'in good shape',book,'high heels').

I am having difficulties with this clue:

or(suspect1, suspect2, suspect3, listOfSuspects)

This clue is supposed to say that the suspect1 has the same traits as suspect2 OR as suspect3 but not both. Example: To indicate that the suspect who is 50 years old has a ring or a mac, but not both:

or(suspect(_, 50, _, _, _, _),
suspect(_, _, _, _, ring, _),
suspect(_, _, _, _, mac, _), listOfSuspects).

Thanks for helping.

 
Is is possible that sameas(S1, S2) and sameas(S1, S3) implies sameas(S2,S3) ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top