Guest User

Untitled

a guest
May 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. reachable(Station1, Limit, Result) :-
  2. reachable(Station1, [Station1], 0, Limit, Result).
  3.  
  4. reachable(Station1, Visited, TimeSpent, Limit, Result) :-
  5. (
  6. overground(Station1, Station2, Time);
  7. overground(Station2, Station1, Time)
  8. ),
  9. \+member(Station2,Visited),
  10. NewTimeSpent is TimeSpent + Time,
  11. (
  12. NewTimeSpent =< Limit,
  13. Result = Station2
  14. ;
  15. reachable(Station2, [Station2|Visited], NewTimeSpent, Limit, Result)
  16. ).
Add Comment
Please, Sign In to add comment