Anonymous user
Pentomino tiling: Difference between revisions
m
→{{header|Python}}: prettier print
m (→{{header|Python}}: prettier print) |
|||
Line 1,487:
((132866, 6, 6),))
boxchar_double_width = ' ╶╺╵└┕╹┖┗╴─╼┘┴┶┚┸┺╸╾━┙┵┷┛┹┻╷┌┍│├┝╿┞┡┐┬┮┤┼┾┦╀╄┑┭┯┥┽┿┩╃╇╻┎┏╽┟┢┃┠┣┒┰┲┧╁╆┨╂╊┓┱┳┪╅╈┫╉╋'
boxchar_single_width = [c + ' ─━'[i%3] for i, c in enumerate(boxchar_double_width)]
# choose drawing alphabet based on terminal font
patterns = boxchar_single_width
Line 1,500 ⟶ 1,501:
def img(seq):
b = [[
for i, s in enumerate(seq):
for j, k in product(range(8), range(8)):
if s & (1<<(j*8 + k)):
b[j + 1][k + 1] = i + 1
idices = [[0]*9 for _ in range(9)]
for i, j in product(range(9), range(9)):
n = (b[i+1][j+1], b[i][j+1], b[i
idices[i][j] = sum((
return '\n'.join(''.join(patterns[i] for i in row) for row in idices)
Line 1,532 ⟶ 1,533:
print(x)</lang>
{{out}}
<pre> ┏━┯━━━┯━━━━━━━┓
┗━━━━━┷━━━━━┷━━━┛
┏━┯━━━┓ ┏━┯━━━┓
┗━━━━━┷━━━━━┷━━━┛
(
</pre>
|