daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #domain piece(P).
  3. #domain piece(P1).
  4. #domain piece(P2).
  5. #domain piece(P3).
  6. #domain piece(P4).
  7. #domain type(T).
  8. #domain direction(D).
  9. #domain direction(D1).
  10. #domain direction(D2).
  11. #domain direction(D2).
  12.  
  13. direction(north;south;east;west).
  14.  
  15. opposite(north,south).
  16. opposite(east,west).
  17. opposite(west,east).
  18. opposite(south,north).
  19.  
  20. type(source).
  21. type(target).
  22. type(blocker).
  23. type(divider).
  24.  
  25. { edge(P1,P2,D1) } :-
  26.     P1 != P2,
  27.     output_direction(P1,D1),
  28.     input_direction(P2,D2),
  29.     opposite(D1,D2).
  30.  
  31. :- edge(P,P1,D), edge(P,P2,D), P1 < P2. % sufficient to check one side of ineq
  32. :- edge(P1,P,D), edge(P2,P,D), P1 < P2.
  33.  
  34. edge(P1,P2) :- edge(P1,P2,D).
  35.  
  36. :- edge(P1,P2), tag(P1,source), tag(P2,target).
  37.  
  38. :- edge(P,P1), not laser_out(P).
  39.  
  40. laser_out(P) :- tag(P,source).
  41. laser_out(P) :- tag(P,divider), laser_in(P).
  42.  
  43. laser_in(P2) :- edge(P1,P2), laser_out(P1).
  44.  
  45. :- tag(P,target), not laser_in(P).
  46.  
  47. in_play(P) :- edge(P,_).
  48. in_play(P) :- edge(_,P).
  49. in_play(P) :- tag(P,source).
  50. in_play(P) :- tag(P,target).
  51. in_play(P) :- tag(P,blocker).
  52.  
  53. fixed(P) :- at(P,X,Y).
  54.  
  55. #domain split_count(S).
  56. split_count(1..3).
  57. divider_outs(P,S) :- tag(P,divider), S { output_direction(P,Di) :direction(Di) } S.
  58.  
  59. #hide.
  60. #show edge/3.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top