# Encoding edge-matching_decision.gringo

Name edge-matching_decision.gringo [Root]    Puzzles (51)    Grid (17) Martin Gebser Martin Gebser and Roland Kaminski A Gringo encoding of the Edge Matching problem. 2009-03-27 12:58 2009-12-03 15:53 Edge Matching col/1rotation/1row/1tile/1tileSide/3 chosenRotation/3chosenTile/3col/1rotation/1row/1tile/1tileSide/3 No ASP Contest 09 (Martin Gebser) #hide rotate/3. #hide color/4. 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). 1 { chosenTile(X,Y,N) : row(Y) : col(X) } 1 :- tile(N). 1 { chosenTile(X,Y,N) : tile(N) } 1 :- row(Y), col(X). 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.