# Encoding solitaire_chk.lp

Name solitaire_chk.lp [Root]    Miscellaneous (45)    ASP Contest 09 (45) Martin Gebser Martin Gebser and Roland Kaminski 2009-03-27 12:58 2009-03-27 12:58 No #hide dir/3. #hide field/2. #hide field/3. #hide stone/3. #hide moved/3. #hide removed/3. :- moved(T,D,X,Y), not time(T). :- moved(T,D,X,Y), not field(X,Y,D). field(X,Y) :- empty(X,Y). field(X,Y) :- full(X,Y). dir(left ,-1, 0). dir(right, 1, 0). dir(up , 0,-1). dir(down , 0, 1). stone(X,Y,0) :- full(X,Y). field(X,Y,D) :- field(X,Y), field(X+DX,Y+DY), field(X+2*DX,Y+2*DY), dir(D,DX,DY). :- not 1 { move(T,D,X,Y) : field(X,Y,D) } 1, time(T). :- move(T,D,X,Y), not stone(X,Y,T-1). :- move(T,D,X,Y), stone(X+2*DX,Y+2*DY,T-1), dir(D,DX,DY). :- move(T,D,X,Y), not stone(X+DX,Y+DY,T-1), dir(D,DX,DY). moved(T,X,Y) :- move(T,D,X,Y), time(T). removed(T,X+DX,Y+DY) :- move(T,D,X,Y), dir(D,DX,DY). stone(X+2*DX,Y+2*DY,T) :- move(T,D,X,Y), dir(D,DX,DY). stone(X,Y,T) :- field(X,Y), stone(X,Y,T-1), not moved(T,X,Y), not removed(T,X,Y), time(T).