Advertisement
Guest User

Untitled

a guest
May 27th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.67 KB | None | 0 0
  1. best_match(SOV_List, "", 0).
  2.  
  3.  
  4. best_match(SOV_List,Best_Title,Best_Count):-
  5.     plot_story(Story_List,Title),
  6.     match(SOV_List,Story_List,0,N),
  7.     N > 1,
  8.     best(N, Title,Best_Count, Best_Title, New_Best_Count, New_Best_Title),
  9.     best_match(SOV_List, New_Best_Title, New_Best_Count),
  10.     write(Best_Title),
  11.     nl.
  12.  
  13. best_match(_,_,_).
  14.  
  15.  
  16. best(Count,Count_Title,Best_Count,_,Count,Count_Title):-Count>Best_Count.
  17. best(_,_,Best_Count,Best_Title,Best_Count,Best_Title).
  18.  
  19. match([],_,Count,Count).
  20.  
  21. match([H|T],Story_List,Count,N):-
  22.     member(H,Story_List),
  23.     Count_Temp is Count+1,
  24.     match(T,Story_List,Count_Temp,N).
  25.  
  26. match([_|T],Story_List,Count,N):-
  27.     match(T,Story_List,Count,N).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement