instances dir u,d,l,r. fluents empty : row x col -> boolean = true. % each position is empty or not wrow: wire -> row. % row of the wire end wcol: wire -> col. % column of the wire end actions move_dir: wire -> dir. static row_inc, col_inc: dir -> {-1..1} = 0. rules row_inc(u)= -1. row_inc(d)= 1. col_inc(l)= -1. col_inc(r)= 1. vars W,W2:wire. rules % How a movement in a wire W affects to the wire end position wrow'(W)=wrow(W)+row_inc(move_dir(W)). wcol'(W)=wcol(W)+col_inc(move_dir(W)). % The wire end position is never empty not empty(wrow(W),wcol(W)). % When you move the end of wire W, the new position must be previously empty :- not unknown(move_dir(W)), not empty(wrow'(W),wcol'(W)). % Two different wires cannot end at the same position :- W!=W2, wrow(W)=wrow(W2), wcol(W)=wcol(W2).