The code below is written in Prolog. I to rearrange, change the code so that it returns the "Ad,Soyad,Kolekitem,Sure" matches it finds in the format of (Ad,Soyad,Kolekitem,Sure) but my code doesn't do it. It just returns true. The explanation of the goal, rules is given in english below the Prolog code. I can also send the other stuff I tried in Prolog if you need anything else. Please help.
The Prolog Code:
kisi(Ad,Soyad,Kolekitem,Sure):-
member(Ad,[dilhan,ismail,leman,rana,selim]),
member(Soyad,[kilit,cenk,gumuscu,trabzon,naz]),
member(Kolekitem,[hali,ayakkabi,metalpara,madalyon,camesya]),
member(Sure,[3,4,5,6,7]).
r1(Ad,Soyad,Kolekitem,Sure):-
Item=Kolekitem,
Soyad=kilit,
kisi(Ad,Soyad,Item,Sure),
Item\=hali.
r2(Ad,Soyad,Kolekitem,Sure):-
Ad=dilhan,Kolekitem=ayakkabi,
kisi(Ad,Soyad,Kolekitem,Sure).
r3(Ad,Ad1,Soyad,Soyad1,Kolekitem,Kolekitem1,Sure,Sure1):-
Ad=dilhan,
Kolekitem=ayakkabi,
kisi(Ad,Soyad,Kolekitem,Sure),
Soyad1=kilit,
kisi(Ad1,Soyad1,Kolekitem1,Sure1),
Sure is Sure1+2.
r4(Ad,Soyad,Kolekitem,Sure):-
Soyad=cenk,
kisi(Ad,Soyad,Kolekitem,Sure),
Sure\=6.
r5(Ad,Ad1,Soyad,Soyad1,Kolekitem,Kolekitem1,Sure,Sure1):-
Kolekitem=camesya,
kisi(Ad,Soyad,Kolekitem,Sure),
Soyad1=gumuscu,
kisi(Ad1,Soyad1,Kolekitem1,Sure1),
Sure is Sure1+2.
r6(Ad,Soyad,Kolekitem,Sure):-
Kolekitem=hali,
kisi(Ad,Soyad,Kolekitem,Sure),
Ad\=selim.
r7(Ad,Ad1,Soyad,Soyad1,Kolekitem,Kolekitem1,Sure,Sure1):-
Kolekitem=hali,
kisi(Ad,Soyad,Kolekitem,Sure),
Ad1=leman,
kisi(Ad1,Soyad1,Kolekitem1,Sure1),
Sure1>Sure.
r8(Ad,Ad1,Soyad,Soyad1,Kolekitem,Kolekitem1,Sure,Sure1):-
Kolekitem=madalyon,
kisi(Ad,Soyad,Kolekitem,Sure),
Ad1=leman,
kisi(Ad1,Soyad1,Kolekitem1,Sure1),
Sure1>Sure.
r9(Ad,Ad1,Soyad,Soyad1,Kolekitem,Kolekitem1,Sure,Sure1):-
Kolekitem=metalpara,
kisi(Ad,Soyad,Kolekitem,Sure),
Ad1=ismail,
kisi(Ad1,Soyad1,Kolekitem1,Sure1),
Sure is Sure1+2.
r10(Ad,Soyad,Kolekitem,Sure):-
Soyad=trabzon,
Sure=5,
kisi(Ad,Soyad,Kolekitem,Sure).
coz():-
r1(A1,B1,C1,D1),
r2(E1,F1,G1,H1),
r3(I1,J1,K1,L1,M1,N1,O1,P1),
r4(R1,S1,T1,U1),
r5(V1,Y1,Z1,X1,A,B,C,D),
r6(E,F,G,H),
r7(A2,B2,C2,D2,E2,F2,G2,H2),
r8(I2,J2,K2,L2,M2,N2,O2,P2),
r9(R2,S2,T2,U2,V2,Y2,Z2,X2),
r10(V,Y,Z,X).
Explanation of the rules in english:
There are five names: dilhan, ismail, selim, rana, leman
there are five surnames: kilit, cenk, gumuscu, trabzon, naz
there are five collectable items that each person collects: hali, camesya, metalpara, ayakkabi, madalyon
each of these people have been collecting these items for different amounts of time: 3 years, 4 years, 5 years, 6 years, 7 years
The goal is to link these informations to know which person has which surname, name, the items they collect and for how long they have been collecting these items. Example: dilhan, kilit, metalcoins, 6years.
the known facts goes as follows:
- Each person has one of the names given above, no two people have the same name.
- Each person has one of the surnames given above, no two people have the same surname. 3.Each person collects one of the collectable items given above, no two people collect the same items
- Each person has been collecting for a different amount of time, no two people has been collecting for the same amount of time. Each person have been collecting for the times given above.
- The person named "dilhan" collects "ayakkabi". 6.The person with the surname "kilit" doesn't collect "hali".
- The person named "dilhan" has been collecting for 2 years more than the person with the surname "kilit".
- The person with the surname "cenk" hasn't been collecting items for 6 years (so the person with the surname "cenk" might be collecting for 3,4,5,7 years but not 6).
- The person who collects "camesya" has been collecting for 2 years more than the person with the surname "gumuscu".
- The person who collects "hali" isn't named "selim".
- The person who collects "hali" has been collecting for a shorter period of time than the person named "leman".
- The person who collects "madalyon" has been collecting for a shorter period of time than the person named "leman".
- The person who collects "metalpara" has been collecting for 2 years more than the person named "ismail".
- The person with the surname "trabzon" has been collecting for 5 years.