Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- best_match(SOV_List, "", 0).
- best_match(SOV_List,Best_Title,Best_Count):-
- plot_story(Story_List,Title),
- match(SOV_List,Story_List,0,N),
- N > 1,
- best(N, Title,Best_Count, Best_Title, New_Best_Count, New_Best_Title),
- best_match(SOV_List, New_Best_Title, New_Best_Count),
- write(Best_Title),
- nl.
- best_match(_,_,_).
- best(Count,Count_Title,Best_Count,_,Count,Count_Title):-Count>Best_Count.
- best(_,_,Best_Count,Best_Title,Best_Count,Best_Title).
- match([],_,Count,Count).
- match([H|T],Story_List,Count,N):-
- member(H,Story_List),
- Count_Temp is Count+1,
- match(T,Story_List,Count_Temp,N).
- match([_|T],Story_List,Count,N):-
- match(T,Story_List,Count,N).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement