trace domains gamelist = symbol* teamlist = symbol* finallist = symbol* newlist = symbol* database players(integer,symbol,gamelist) games(symbol,integer) student_db(integer,symbol) predicates find_players(symbol,teamlist) enter_game() go repeate initialize() member(symbol,gamelist) display_list(finallist,integer) display_db(finallist,integer) combination(integer,finallist,newlist) goal go. clauses repeate. repeate :- repeate. go :- initialize(), enter_game(). initialize() :- assert(players(1,\"hemal\",[cricket,football])), assert(players(2,\"shashank\",[football,carrom])), assert(players(3,\"nilay\",[carrom,chess])), assert(players(4,\"khilan\",[cricket,chess])), assert(players(5,\"gediya\",[football,carrom])), assert(players(6,\"kk\",[carrom,cricket])), assert(players(7,\"hh\",[carrom,football])). member(X,[X|_]). member(X,[_|Tail]) :- member(X,Tail). enter_game() :- write(\"Enter the Name of Game : \"), readln(GNAME), find_players(GNAME,TEAMLIST), display_db(FINALLIST,0). find_players(GNAME,TEAMLIST) :- players(NO,NAME,G_LIST), member(GNAME,G_LIST), assert(student_db(NO,NAME)), fail. find_players(GNAME,TEAMLIST). display_db(FINALLIST,CNT) :- student_db(N1,N), FINALLIST1 = [N | FINALLIST], write(N), write(\" \"), retract(student_db(N1,N)), CNT1 = CNT + 1, display_db(FINALLIST1,CNT1). display_db(FINALLIST,CNT) :- % display_list(FINALLIST,CNT), nl, write(\"The possible combinations are : \"), combination(2,FINALLIST,NEWLIST), nl, readchar(_), write(NEWLIST), fail. display_list([H | T],CNT) :- TMPLIST1 = [H|T], write(H), CNT1 = CNT - 1, CNT > 0, display_list(T,CNT1). combination(NPLAYER,[X|TAIL],[X|COMB]) :- NPLAYER > 0, TMP = NPLAYER - 1, combination(TMP,TAIL,COMB). combination(NPLAYER,[_|TAIL],COMB) :- NPLAYER > 0, combination(NPLAYER,TAIL,COMB). combination(0,_,[]).