# Encoding maze-generation_chk.lp

Name maze-generation_chk.lp [Root]    Miscellaneous (45)    ASP Contest 09 (45) Martin Gebser Martin Gebser and Roland Kaminski 2009-03-27 15:23 2009-03-27 15:23 No #hide adjacent/4. #hide grid/2. #hide maxcol/1. #hide maxrow/1. #hide border/2. #hide reach/2. :- exit(X,Y), wall(X,Y). :- wall(X,Y), empty(X,Y). :- wall(X,Y), not grid(X,Y). :- empty(X,Y), not grid(X,Y). :- grid(X,Y), not wall(X,Y), not empty(X,Y). grid(X,Y) :- col(X), row(Y). adjacent(X,Y,X,Y+1) :- grid(X,Y), row(Y+1). adjacent(X,Y,X,Y-1) :- grid(X,Y), row(Y-1). adjacent(X,Y,X+1,Y) :- grid(X,Y), col(X+1). adjacent(X,Y,X-1,Y) :- grid(X,Y), col(X-1). maxcol(X) :- col(X), not col(X+1). maxrow(Y) :- row(Y), not row(Y+1). border(1,Y) :- col(1), row(Y). border(X,1) :- col(X), row(1). border(X,Y) :- row(Y), maxcol(X). border(X,Y) :- col(X), maxrow(Y). reach(X,Y) :- entrance(X,Y), empty(X,Y). reach(XX,YY) :- adjacent(X,Y,XX,YY), reach(X,Y), empty(XX,YY). :- empty(X,Y), not reach(X,Y). :- wall(X,Y), wall(X+1,Y), wall(X,Y+1), wall(X+1,Y+1). :- empty(X,Y), empty(X+1,Y), empty(X,Y+1), empty(X+1,Y+1). :- wall(X,Y), empty(X+1;X-1,Y), empty(X,Y+1;Y-1), grid(X+1;X-1,Y+1;Y-1). :- wall(X,Y), wall(X+1,Y+1), not wall(X+1,Y), not wall(X,Y+1). :- wall(X+1,Y), wall(X,Y+1), not wall(X,Y), not wall(X+1,Y+1).