Diamond cards by nn

o=S='-'*17
System.in.eachLine{n=0.decode(it)
v=n>8?5533:n>5?381:n>3?29:0
u=[7,29,381,0,7,0,4,74,7,59][n-1]
0.upto(270){i->d=-4
z=1
o+=i%18?[v,u,v].every{for(d+=6;it;it>>=4)z*=(i<(k=it%16*18+d)||k+2<i)&&i-k+17&&i-k-19?1:0
z}?' ':'*':'\n'}
o+=S}
print o

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

download

return to the top page