I am trying to interpret a clingo code for a sudoku and the last two lines confuse a lot. Is there anyone experienced with that, who can explain to me what I see?
%same_line(X1,X2) :- value(X1), value(X2), (X1-1)/3 == (X2-1)/3.
%:- sudoku(X1,Y1,N), sudoku(X2,Y2,N), same_line(X1,X2), same_line(Y1,Y2), X1 != X2, Y1 != Y2.
What I think I understand is that in the first line it is described how the values are being distributed in every line and in the second line I believe it is a constrain rule that would delete a row, column or subgrid with the same number.
The X1 != X2 and Y1 != Y2 is also abit confusing
This seems to be the rule that each square of 3x3 can contain each number only once.
Second rule reads something like
Another way to write it would be