# Encoding edge-matching_chk.lp

Name edge-matching_chk.lp [Root]    Miscellaneous (45)    ASP Contest 09 (45) Martin Gebser Martin Gebser and Roland Kaminski 2009-03-27 12:58 2009-12-03 15:54 No #hide rotate/3. #hide color/4. :- chosenTile(X,Y,N), not row(Y). :- chosenTile(X,Y,N), not col(X). :- chosenTile(X,Y,N), not tile(N). :- chosenRotation(X,Y,R), not row(Y). :- chosenRotation(X,Y,R), not col(X). :- chosenRotation(X,Y,R), not rotation(R). rotate(R,0,R) :- side(R). rotate(top,90,right). rotate(top,180,bottom). rotate(top,270,left). rotate(right,90,bottom). rotate(right,180,left). rotate(right,270,top). rotate(bottom,90,left). rotate(bottom,180,top). rotate(bottom,270,right). rotate(left,90,top). rotate(left,180,right). rotate(left,270,bottom). :- not 1 { chosenTile(X,Y,N) : row(Y) : col(X) } 1, tile(N). :- not 1 { chosenTile(X,Y,N) : tile(N) } 1, row(Y), col(X). :- not 1 { chosenRotation(X,Y,R) : rotation(R) } 1, row(Y), col(X). color(X,Y,SR,C) :- chosenTile(X,Y,N), chosenRotation(X,Y,R), tileSide(N,S,C), rotate(S,R,SR). :- color(X,Y,right,C1), color(X+1,Y,left,C2), C1 != C2. :- color(X,Y,bottom,C1), color(X,Y+1,top,C2), C1 != C2.