clpfd - Graph Sudoku Prolog -


i have assignment clp ct. had @ many block sudoku examples. learnt how define list of rows, columns , boxes. understood problem different classical block sudoku examples.

we have graph g=(v,e) no neighboring vertices have same number.

gsudoku (edges,n), label (v).

output:

?- gsudoku([e(x,y),e(y,z),e(z,x)],2),label([x,y,z]). false ?- gsudoku([e(x,y),e(y,z),e(z,x)],3),label([x,y,z]). x=1 y=2 z=3 , (other permutations) 

should think 3x3 sudoku examples because have 3 points?

could please me how can solve it? advance thanks!

for future readers here code:

:- use_module(library(clpfd)). gsudoku([],_). gsudoku([e(f,t)|xs],n):- f in 1.. n,  t in 1.. n ,  f #\= t ,  gsudoku(xs,n). 

Comments