/* Pi Day Sudoku 2010 in Picat. http://brainfreezepuzzles.com/main/piday2010.html """ This puzzle only has 18 clues! That is conjectured to be the least number of clues that a unique-solution rotationally symmetric puzzle can have. To celebrate Pi Day, the given clues are the first 18 digits of π = 3.14159265358979323... """ Via http://threesixty360.wordpress.com/2010/03/09/pi-day-sudoku-is-back/ This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import cp. main => go. go => S = 3, N = S * S, X = [[7,2,_, _,_,_, _,_,_], [_,5,_, _,_,9, _,_,_], [_,_,_, _,3,8, _,_,_], [_,_,_, 4,_,_, 5,_,_], [_,_,3, _,_,_, 9,_,_], [_,_,1, _,_,3, _,_,_], [_,_,_, 2,5,_, _,_,_], [_,_,_, 6,_,_, _,3,_], [_,_,_, _,_,_, _,1,9]], X :: 1..N, foreach(I in 1..N) all_different([X[I,J] : J in 1..N]), all_different([X[J,I] : J in 1..N]) end, foreach(I in 0..2, J in 0..2) all_different([X[R,C] : R in I*3+1..I*3+3, C in J*3+1..J*3+3]) end, solve(X), foreach(Row in X) println(Row) end, nl, fail, nl.