// 2017 (C) Jussi Rintanen // Tile constraint: Exactly one tile in every cell forall x : [1..9] forall y : [1..9] exactlyone n : [1..9] tile(x,y,n) end end end; // Column constraint: every tile is in every column exactly once forall n : [1..9] forall x : [1..9] exactlyone y : [1..9] tile(x,y,n) end end end; // Row constraint: every tile is in every row exactly once forall n : [1..9] forall y : [1..9] exactlyone x : [1..9] tile(x,y,n) end end end; // Cube constraints: every tile is in every 3x3 grid once forall n : [1..9] exactlyone x : [1..3] y : [1..3] tile(x,y,n) end end; forall n : [1..9] exactlyone x : [1..3] y : [4..6] tile(x,y,n) end end; forall n : [1..9] exactlyone x : [1..3] y : [7..9] tile(x,y,n) end end; forall n : [1..9] exactlyone x : [4..6] y : [1..3] tile(x,y,n) end end; forall n : [1..9] exactlyone x : [4..6] y : [4..6] tile(x,y,n) end end; forall n : [1..9] exactlyone x : [4..6] y : [7..9] tile(x,y,n) end end; forall n : [1..9] exactlyone x : [7..9] y : [1..3] tile(x,y,n) end end; forall n : [1..9] exactlyone x : [7..9] y : [4..6] tile(x,y,n) end end; forall n : [1..9] exactlyone x : [7..9] y : [7..9] tile(x,y,n) end end; // Known cell contents // From Wikipedia //tile(1,9,5); //tile(2,9,3); //tile(5,9,7); //tile(1,8,6); //tile(4,8,1); //tile(5,8,9); //tile(6,8,5); //tile(2,7,9); //tile(3,7,8); //tile(8,7,6); //tile(1,6,8); //tile(5,6,6); //tile(9,6,3); //tile(1,5,4); //tile(4,5,8); //tile(6,5,3); //tile(9,5,1); //tile(1,4,7); //tile(5,4,2); //tile(9,4,6); //tile(2,3,6); //tile(7,3,2); //tile(8,3,8); //tile(4,2,4); //tile(5,2,1); //tile(6,2,9); //tile(9,2,5); //tile(5,1,8); //tile(8,1,7); //tile(9,1,9); // Telegraph, Arto Inkala, "very hard" tile(1,9,8); tile(3,8,3); tile(4,8,6); tile(2,7,7); tile(5,7,9); tile(7,7,2); tile(2,6,5); tile(6,6,7); tile(5,5,4); tile(6,5,5); tile(7,5,7); tile(4,4,1); tile(8,4,3); tile(3,3,1); tile(8,3,6); tile(9,3,8); tile(3,2,8); tile(4,2,5); tile(8,2,1); tile(2,1,9); tile(7,1,4);