Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. check_path([], _, _, classX).
  2. check_path([StateA|Path], StateA, StateB, Class):-
  3. check_path2(Path, StateB,Class).
  4.  
  5. check_path([X |Path], StateA, StateB, Class):-
  6. X \= StateA,
  7. check_path(Path, StateA, StateB, Class).
  8.  
  9. check_path2([], _, classA).
  10.  
  11. check_path2([A|Path], A, classAB).
  12.  
  13. check_path2([A|Path], B, Class):-
  14. A \= B,
  15. check_path2(Path,B, Class).
  16.  
  17.  
  18.  
  19.  
  20.  
  21. insert_path(Path, classAB, PartialAB, PartialA, [Path|PartialAB], PartialA).
  22. insert_path(Path, classA, PartialAB, PartialA, PartialAB, [Path|PartialA]).
  23. insert_path(Path, classX, PartialAB, PartialA, PartialAB, PartialA).
  24.  
  25. proces_paths([], _, _, PathsAB, PathsA, PathsAB, PathsA).
  26.  
  27. proces_paths([Path|RestPaths], StateA, StateB, PartialAB, PartialA, PathsAB, PathsA):-
  28. check_path(Path, StateA, StateB, Class),
  29. insert_path(Path, Class, PartialAB, PartialA, NewAB, NewA),
  30. proces_paths(RestPaths, StateA, StateB, NewAB, NewA, PathsAB, PathsA).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement