fork download
  1. declare
  2. proc {Sudoku P ?Grid}
  3. Grid = {List.make 9}
  4. {List.forAll Grid proc {$ Row} Row = {FD.list 9 1#9} end}
  5. for I in 1..9 do
  6. {FD.distinct {Nth Grid I}}
  7. end
  8. for J in 1..9 do
  9. {FD.distinct {List.map Grid fun {$ Row}
  10. {Nth Row J}
  11. end
  12. }
  13. }
  14. end
  15. for BI in 0..2 do
  16. for BJ in 0..2 do
  17. Block = for I in 1..3 collect:Collect do
  18. for J in 1..3 do
  19. {Collect {Nth {Nth Grid (3*BI+I)} (3*BJ+J)}}
  20. end
  21. end
  22. in
  23. {FD.distinct Block}
  24. end
  25. end
  26. {List.forAllInd P
  27. proc {$ Y R}
  28. Row = {Nth Grid Y}
  29. in
  30. {List.forAllInd R
  31. proc {$ X I}
  32. if {Not {IsFree I}} then
  33. {Nth Row X} :: I
  34. end
  35. end
  36. }
  37. end
  38. }
  39. {FD.distribute ff {Flatten Grid}}
  40. end
  41. declare
  42. Puzzle=[
  43. [_ _ _ 6 _ _ _ _ 4]
  44. [8 _ _ _ _ _ _ 7 _]
  45. [_ _ 5 _ _ 9 _ _ 3]
  46. [_ _ _ 8 _ _ 2 _ 1]
  47. [_ 9 _ _ _ _ _ 6 _]
  48. [4 _ 6 _ _ 3 _ _ _]
  49. [1 _ _ 2 _ _ 5 _ _]
  50. [_ 7 _ _ _ _ _ _ 8]
  51. [3 _ _ _ _ 4 _ _ _]
  52. ]
  53. {Browse {Search.base.one proc{$ Sol} {Sudoku Puzzle Sol} end}}
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Mozart Compiler 1.4.0 (20080704) playing Oz 3

%%% feeding file prog.oz

%********************* binding analysis error *******************
%**
%** variable FD not introduced
%**
%** in file "./prog.oz", line 4, column 41

%********************* binding analysis error *******************
%**
%** variable FD not introduced
%**
%** in file "./prog.oz", line 6, column 7

%********************* binding analysis error *******************
%**
%** variable FD not introduced
%**
%** in file "./prog.oz", line 9, column 7

%********************* binding analysis error *******************
%**
%** variable FD not introduced
%**
%** in file "./prog.oz", line 23, column 3

%********************* binding analysis error *******************
%**
%** variable FD not introduced
%**
%** in file "./prog.oz", line 39, column 4
%** ------------------ rejected (5 errors)
stdout
Standard output is empty