% representation of the board % col(.) and row(.) as in the queen example % bad(.) for damaged cell % ntiles is a constant for the number of tiles % report no answer in 58 sec col(1..n). row(1..n). tile(1..ntiles). bad(1,1). bad(3,3). 2 {cell(I,J,T) : col(I) : row(J) } 2 :- tile(T). % bad cell needs not be covered :- col(I), row(J), tile(T), bad(I,J), cell(I,J,T). % one tile over one cell only :- col(I), row(J), tile(T1), tile(T2), neq(T1,T2), cell(I,J,T1), cell(I,J,T2). % cell covered by the same tile must be neightbor % (not far from each other) :- tile(T), cell(I1,J1,T), cell(I2,J2,T), col(I1), col(I2), row(J1), row(J2), I1 - I2 > 1. :- tile(T), cell(I1,J1,T), cell(I2,J2,T), col(I1), col(I2), row(J1), row(J2), J1 - J2 > 1. % they cannot be on a diagonal :- tile(T), cell(I1,J1,T), cell(I2,J2,T), col(I1), col(I2), row(J1), row(J2), neq(I1,I2), neq(J1,J2). hide row(_). hide col(_). hide tile(_). hide bad(_,_).