<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">sudoku([
     A1,A2,A3,  A4,A5,A6,  A7,A8,A9,
     B1,B2,B3,  B4,B5,B6,  B7,B8,B9,
     C1,C2,C3,  C4,C5,C6,  C7,C8,C9,

     D1,D2,D3,  D4,D5,D6,  D7,D8,D9,
     E1,E2,E3,  E4,E5,E6,  E7,E8,E9,
     F1,F2,F3,  F4,F5,F6,  F7,F8,F9,

     G1,G2,G3,  G4,G5,G6,  G7,G8,G9,
     H1,H2,H3,  H4,H5,H6,  H7,H8,H9,
     I1,I2,I3,  I4,I5,I6,  I7,I8,I9]) :-

   fd_domain([
     A1,A2,A3,  A4,A5,A6,  A7,A8,A9,
     B1,B2,B3,  B4,B5,B6,  B7,B8,B9,
     C1,C2,C3,  C4,C5,C6,  C7,C8,C9,

     D1,D2,D3,  D4,D5,D6,  D7,D8,D9,
     E1,E2,E3,  E4,E5,E6,  E7,E8,E9,
     F1,F2,F3,  F4,F5,F6,  F7,F8,F9,

     G1,G2,G3,  G4,G5,G6,  G7,G8,G9,
     H1,H2,H3,  H4,H5,H6,  H7,H8,H9,
     I1,I2,I3,  I4,I5,I6,  I7,I8,I9],1,9),
  
 % Contraintes all_diff pour les lignes
   fd_all_different([A1,A2,A3,  A4,A5,A6,  A7,A8,A9]),
   fd_all_different([B1,B2,B3,  B4,B5,B6,  B7,B8,B9]),
   fd_all_different([C1,C2,C3,  C4,C5,C6,  C7,C8,C9]),
   fd_all_different([D1,D2,D3,  D4,D5,D6,  D7,D8,D9]),
   fd_all_different([E1,E2,E3,  E4,E5,E6,  E7,E8,E9]),
   fd_all_different([F1,F2,F3,  F4,F5,F6,  F7,F8,F9]),
   fd_all_different([G1,G2,G3,  G4,G5,G6,  G7,G8,G9]),
   fd_all_different([H1,H2,H3,  H4,H5,H6,  H7,H8,H9]),
   fd_all_different([I1,I2,I3,  I4,I5,I6,  I7,I8,I9]),
 
 % Contraintes all_diff pour les colonnes
   fd_all_different([A1,B1,C1,D1,E1,F1,G1,H1,I1]),
   fd_all_different([A2,B2,C2,D2,E2,F2,G2,H2,I2]),
   fd_all_different([A3,B3,C3,D3,E3,F3,G3,H3,I3]),
   fd_all_different([A4,B4,C4,D4,E4,F4,G4,H4,I4]),
   fd_all_different([A5,B5,C5,D5,E5,F5,G5,H5,I5]),
   fd_all_different([A6,B6,C6,D6,E6,F6,G6,H6,I6]),
   fd_all_different([A7,B7,C7,D7,E7,F7,G7,H7,I7]),
   fd_all_different([A8,B8,C8,D8,E8,F8,G8,H8,I8]),
   fd_all_different([A9,B9,C9,D9,E9,F9,G9,H9,I9]),

 % Contraintes all_diff pour les chacun des carrÃ©s
  fd_all_different([A1,A2,A3, B1,B2,B3, C1,C2,C3]),
  fd_all_different([A4,A5,A6, B4,B5,B6, C4,C5,C6]),
  fd_all_different([A7,A8,A9, B7,B8,B9, C7,C8,C9]),
  fd_all_different([D1,D2,D3, E1,E2,E3, F1,F2,F3]), 
  fd_all_different([D4,D5,D6, E4,E5,E6, F4,F5,F6]),
  fd_all_different([D7,D8,D9, E7,E8,E9, F7,F8,F9]), 
  fd_all_different([G1,G2,G3, H1,H2,H3, I1,I2,I3]),
  fd_all_different([G4,G5,G6, H4,H5,H6, I4,I5,I6]),
  fd_all_different([G7,G8,G9, H7,H8,H9, I7,I8,I9]),

 % EnumÃ©ration
  fd_labelingff([
     A1,A2,A3,  A4,A5,A6,  A7,A8,A9,
     B1,B2,B3,  B4,B5,B6,  B7,B8,B9,
     C1,C2,C3,  C4,C5,C6,  C7,C8,C9,

     D1,D2,D3,  D4,D5,D6,  D7,D8,D9,
     E1,E2,E3,  E4,E5,E6,  E7,E8,E9,
     F1,F2,F3,  F4,F5,F6,  F7,F8,F9,

     G1,G2,G3,  G4,G5,G6,  G7,G8,G9,
     H1,H2,H3,  H4,H5,H6,  H7,H8,H9,
     I1,I2,I3,  I4,I5,I6,  I7,I8,I9]).

/* Tests
[1] ?-sudoku(L).

L = [
1,2,3,  4,5,6,  7,8,9,
4,5,6,  8,9,7,  1,2,3,
7,8,9,  1,2,3,  4,5,6,

2,6,1,  3,7,4,  8,9,5,
9,7,5,  2,1,8,  6,3,4,
8,3,4,  5,6,9,  2,1,7,

3,1,7,  6,8,5,  9,4,2,
5,9,2,  7,4,1,  3,6,8,
6,4,8,  9,3,2,  5,7,1] ? 


sudoku([A1,A2,A3,  A4,8, A6,  A7,A8,7,B1,B2,B3,  B4,B5,B6, 9,B8,B9,C1,C2,C3,  9,C5, 5,   3,C8,C9,3,D2,D3,   6,D5,D6,  D7,D8,D9,5,E2, 9,   3,E5, 4,  E7,E8,E9, F1, 7,F3,  F4,F5,F6,  F7, 5,F9,4, 2, 1,  G4, 3, 9,  G7, 7, 8,7,H2, 6,   1,H5,H6,  H7, 9,H9,I1,8,I3,   7,I5,I6,  I7,I8,I9]).
  


A1 = 1
A2 = 9
A3 = 4
A4 = 2
A6 = 3
A7 = 5
A8 = 6
B1 = 2
B2 = 5
B3 = 3
B4 = 4
B5 = 6
B6 = 7
B8 = 8
B9 = 1
C1 = 8
C2 = 6
C3 = 7
C5 = 1
C8 = 4
C9 = 2
D2 = 4
D3 = 8
D5 = 5
D6 = 2
D7 = 7
D8 = 1
D9 = 9
E2 = 1
E5 = 7
E7 = 8
E8 = 2
E9 = 6
F1 = 6
F3 = 2
F4 = 8
F5 = 9
F6 = 1
F7 = 4
F9 = 3
G4 = 5
G7 = 6
H2 = 3
H5 = 4
H6 = 8
H7 = 2
H9 = 5
I1 = 9
I3 = 5
I5 = 2
I6 = 6
I7 = 1
I8 = 3
I9 = 4 ? ;

(4 ms) no
*/
</pre></body></html>