Coasters by grumzik

f(N):-N1 is N+2,between(1,N1,_).\x0d
m:-prompt1(''),readln([W]),!,atom_length(W,L),N is L//4-2,\x0d
\x09a(' ','_','',L),a(/,' ',\,L),\x0d
\x09(f(N),a(|,' ',|,L),fail;true),!,\x0d
\x09p('| '),p(W),p(' |'),nl,\x0d
\x09(f(N),a(|,' ',|,L),fail;true),!,\x0d
\x09a(\,'_',/,L).\x0d
p(X):-write(X).\x0d
a(A,B,C,N):-p(A),f(N),p(B),fail;p(C),nl.

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page