set(arithmetic).
assign(domain_size,6).
assign(max_models,-1).

formulas(utils).
   s(0) = 1. s(1) = 2. s(2) = 3. s(3) = 4.  s(4) = 5.  s(5) = 0.
   p(1) = 0. p(2) = 1. p(3) = 2. p(4) = 3.  p(5) = 4.  p(0) = 5.
end_of_list.

formulas(takuzo).
  all x all y (f(x,y) < 2).    %only black f(x,y)=1, and whites f(x,y)=0
  all x (f(x,0) + f(x,1) + f(x,2) + f(x,3) + f(x,4) + f(x,5))  = 3.
  all y (f(0,y) + f(1,y) + f(2,y) + f(3,y) + f(4,y) + f(5,y))  = 3.
  f(p(x),y) + f(x,y) + f(s(x),y) < 3. %max 3 adjacent black in a column y
  f(p(x),y) + f(x,y) + f(s(x),y) > 0. %min 1 adjacent black in a column y
  f(x,p(y)) + f(x,y) + f(x,s(y)) < 3. %max 3 adjacent black in a line x
  f(x,p(y)) + f(x,y) + f(x,s(y)) > 0. %min 1 adjacent black in a line x
end_of_list.

formulas(sample_puzzle).
  f(0,4) = 0.   f(1,0) = 1.  f(3,0) = 0.  f(3,1) = 0. f(5,2) = 0.  %white
  f(1,1) = 1.   f(3,3) = 0.  f(4,3) = 1.  f(4,4) = 1.              %black
end_of_list.
