Pentomino tiling: Difference between revisions

m
→‎{{header|Python}}: prettier print
m (→‎{{header|Python}}: prettier print)
Line 1,487:
((132866, 6, 6),))
 
boxchar_double_width = ' ╶╺╵└┕╹┖┗╴─╼┘┴┶┚┸┺╸╾━┙┵┷┛┹┻╷┌┍│├┝╿┞┡┐┬┮┤┼┾┦╀╄┑┭┯┥┽┿┩╃╇╻┎┏╽┟┢┃┠┣┒┰┲┧╁╆┨╂╊┓┱┳┪╅╈┫╉╋'
# for drawing in terminal; correct aspect ratio depends on your terminal font
boxchar_single_width = [c + ' ─━'[i%3] for i, c in enumerate(boxchar_double_width)]
boxchar_double_width = ' ██┘█─└┴█┐│┤┌┬├┼'
 
boxchar_single_width = (' ', '██', '██', '┘ ', '██', '──', '└─', '┴─', '██', '┐ ', '│ ', '┤ ', '┌─', '┬─', '├─', '┼─')
# choose drawing alphabet based on terminal font
patterns = boxchar_single_width
 
Line 1,500 ⟶ 1,501:
 
def img(seq):
b = [[-10]*10 for _ in range(10)]
 
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+1][j], b[i+1][j], b[i+1][j+1])
idices[i][j] = sum((n[i]a != n[ib)*(1 -+ 1](not a or not b)<<)*3**i for i, (a,b) in rangeenumerate(4zip(n, n[1:])))
 
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> ┌─┬───┬───────┐
┌─┘┏━┛ └─┐ └─┬─┐ ┌─┤┌─┨
├─┐┠─┐ ┌─┼─┐┌─╆━┓ │ └─┘
├─┤ └─┴─┼─┬───┤┗━┹─╆━┱───┨
│ └───┐ ├─┴─┐┡━┹─┐
│ ┌─┬─┴─┘ ┌─┤
├─┤┢━┪ ├───┬─┘ │
├─┴─┘┠─┺━┛ │ └─┐ └─┤└─┨
┗━━━━━┷━━━━━┷━━━┛
└─────┴─────┴───┘
┏━┯━━━┓ ┏━┯━━━┓
┌─┬───┐ ┌─┬───┐
┌─┘┏━┛ └─┐ └─┤┗━┩ └─┐
├─┐┠─┐ ┌─┼─┐┌─╆━┓ │ ┌─┘
├─┤ └─┴─┤┗━┹─┤ ├───┤├───┨
│ └───┐ ├─┴─┐
│ ┌─┬─┴─┘ ┌─┤
├─┤┢━┪ ├───┬─┘ │
├─┴─┘┠─┺━┛ │ └─┐ └─┤└─┨
┗━━━━━┷━━━━━┷━━━┛
└─────┴─────┴───┘
 
(then it goes on and on)
</pre>