array [1..16] of int: r = [0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1]; var 0..16: INT____00001 :: is_defined_var :: var_is_introduced; array [1..16] of var int: d; var 0..16: moves :: output_var = INT____00001; array [1..16] of var 0..1: x :: output_array([1..4, 1..4]); constraint int_le(0, d[1]); constraint int_le(0, d[2]); constraint int_le(0, d[3]); constraint int_le(0, d[4]); constraint int_le(0, d[5]); constraint int_le(0, d[6]); constraint int_le(0, d[7]); constraint int_le(0, d[8]); constraint int_le(0, d[9]); constraint int_le(0, d[10]); constraint int_le(0, d[11]); constraint int_le(0, d[12]); constraint int_le(0, d[13]); constraint int_le(0, d[14]); constraint int_le(0, d[15]); constraint int_le(0, d[16]); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[1], x[1], x[2], x[3], x[4], x[5], x[9], x[13]], 0); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[2], x[1], x[2], x[3], x[4], x[6], x[10], x[14]], 1); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[3], x[1], x[2], x[3], x[4], x[7], x[11], x[15]], 0); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[4], x[1], x[2], x[3], x[4], x[8], x[12], x[16]], 0); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[5], x[1], x[5], x[6], x[7], x[8], x[9], x[13]], 1); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[6], x[2], x[5], x[6], x[7], x[8], x[10], x[14]], 0); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[7], x[3], x[5], x[6], x[7], x[8], x[11], x[15]], 1); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[8], x[4], x[5], x[6], x[7], x[8], x[12], x[16]], 0); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[9], x[1], x[5], x[9], x[10], x[11], x[12], x[13]], 1); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[10], x[2], x[6], x[9], x[10], x[11], x[12], x[14]], 1); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[11], x[3], x[7], x[9], x[10], x[11], x[12], x[15]], 0); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[12], x[4], x[8], x[9], x[10], x[11], x[12], x[16]], 0); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[13], x[1], x[5], x[9], x[13], x[14], x[15], x[16]], 0); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[14], x[2], x[6], x[10], x[13], x[14], x[15], x[16]], 1); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[15], x[3], x[7], x[11], x[13], x[14], x[15], x[16]], 1); constraint int_lin_eq([-2, 1, 1, 1, 1, 1, 1, 1], [d[16], x[4], x[8], x[12], x[13], x[14], x[15], x[16]], 1); constraint int_lin_eq([-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [INT____00001, x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16]], 0) :: defines_var(INT____00001); solve :: int_search([x[1], x[2], x[3], x[4], x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12], x[13], x[14], x[15], x[16]], first_fail, indomain, complete) minimize INT____00001;