daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Feb 21st, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. partners(stuart,georgie). partners(georgie,stuart).
  2. partners(alan,barbara). partners(barbara,alan).
  3.  
  4. dislikes(georgie,barbara). dislikes(barbara,georgie).
  5. dislikes(stuart,alan). dislikes(alan,stuart).
  6.  
  7. isman(A) :- member(A,[alan,chris,dave,ian,jack,stuart]).
  8. iswoman(A) :- member(A,[barbara,ellie,fiona,georgie,helen]).
  9.  
  10. samesex(A,B) :- ( (isman(A),isman(B)) ; (iswoman(A),iswoman(B)) ), A \= B.
  11.  
  12. singleroom(A) :- ( ( iswoman(A) ; isman(A) ),\+partners(A,Z) ) ; ( ( iswoman(A) ; isman(A) ),partners(A,Z)).
  13. doubleroom(A,B) :- partners(A,B) ; ( samesex(A,B), \+dislikes(A,B) ).
  14. tripleroom(A,B,C) :- samesex(A,B),samesex(B,C),samesex(A,C),\+dislikes(A,B),\+dislikes(B,C),\+dislikes(A,C).
  15.  
  16. accommodation(A,B,C,D,E,F,G,H,I,J,K) :- doubleroom(A,B), doubleroom(C,D), tripleroom(E,F,G), tripleroom(H,I,J), singleroom(K), permutation([A,B,C,D,E,F,G,H,I,J,K], [alan,chris,dave,ian,jack,stuart,barbara,ellie,fiona,georgie,helen])  .
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