You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

12 lines
363 B

#!../k
a:4(+" ",)/0:"i/20"
(m;n):#'(a;*a)
a:,/a
l:l^/(1,n)+\:l:&>/"@Z"<\:a
p:*'("."=a@)#'(,/-1 2*/:1,n)+/:l
g:g0:(^"# "?a@)#'(!#a)+(!0;1 -1,n,-n)"."=a
g[p@|'v],:p v:(2=#:')#.=s:a[l+\:0 1,n]^'" "
(A;Z):p s?$`AA`ZZ
f:{-1+#{(0<#w)&^(w:*|x)?Z}{x,,(,/g@*|x)^x@-2+#x}/,,A}
f 0
f(<[#g;]#'(-1<)#'g:,/g+/:(!30)*#g:@[g0;p@|'v;,;p[v]+((-#a;#a)@|/(c>(m;n)-6)|6>c:(m;n)\p)v])