clingo -c tree_maze_gen.lp --heu=vsids | python display_tree.py

2011-10-05 16:34:23
clingo -c tree_maze_gen.lp --heu=vsids | python display_tree.py
Tweetable version: d(1..50).k(0,-1;;1,0;;-1,0;;0,1).1{u(X,Y,U,V):k(U,V)}1:-d(X;Y).l(1,1).l(X,Y):-u(X,Y,U,V),l(X+U,Y+V).:-d(X;Y),not l(X,Y). Readable version: #const width=50. % dimension values dim(1..width). % step directions on grid step(0,-1). step(1,0). step(-1,0). step(0,1). % pick exactly on parent for a tile 1 { parent(X,Y,DX,DY) :step(DX,DY) } 1 :- dim(X), dim(Y). % linkage through parent pointers linked(1,1). linked(X,Y) :- parent(X,Y,DX,DY), linked(X+DX,Y+DY). % every tile is linked! :- dim(X), dim(Y),not linked(X,Y).
clingoaspmaze
2316 views · 1 faves · CC BY 2.0
Original Flickr page