The predicate is created by breaking down when a list of players or a list of teams are input arguments.
The predicate is created by breaking down when a list of players or a list of teams are input arguments: findTeam(P, H, Age, T) :- player(T, Ps), \+ member(P, Ps), team(T, Coach), coach(Coach, H, A), A > Age. FindTeams(P, H, Age, Ts) :- setof(T, H^findTeam(P, H, Age, T), Ts), member(T, Ts), findTeam(P, H, Age, T). Find1(P, H, Age, Ts) :- findTeams(P, H, Age, Ts).
Find1(P|Ps, H, Age, Ts) :- findTeams(P, H, Age, Ts0), find1(Ps, H, Age, Ts1), intersection(Ts0, Ts1, Ts). TeamPlayers(TP) :- findall((X, Y), (player(X, L), member(Y, L)), TP). FindPlayers(Ps, H, Age, T) :- setof(Y, X^(teamPlayers(TP), member((X,Y), TP), \+ member((T,Y), TP)), Ps), team(T, Coach), coach(Coach, H, A), A > Age.
Find2(Ps, H, Age, T) :- findPlayers(Ps, H, Age, T). Find2(Ps, H, Age, T|Ts) :- findPlayers(Ps0, H, Age, T), find2(Ps1, H, Age, Ts), intersection(Ps0, Ps1, Ps). Find(Ps, H, Age, Ts) :- is_list(Ps), find1(Ps, H, Age, Ts).
Find(Ps, H, Age, Ts) :- is_list(Ts), find2(Ps, H, Age, Ts). Hope it helps.
I have updated the code, you can check it again. You should revise goals of your predicate, some goals are really confusing now. For example, Milan's coach is Allegri and his hair is blonde, so the answer for find(zidane,ronaldo,C,40,X).
Should be C=blonde, X=milan. – pad May 7 at 20:10 the best...thank you very much pad. You're right.
I will change it.. – Palindrom May 7 at 20:36.
Find(P,C,A,L1) :- setof(P1,( coach(Name,C,A1), A1 > A, team(Team1,Name), player(Team1,L2), append(_,P1|_,L2)), L3), append(_,P|_,L3), findall(Team2,( player(Team2,L4), append(_,P|_,L4)), L1).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.