Python etc / new year

Published: 31 December 2020, 18:00

from base64 import b64decode
from random import choice

CELLS = '~' * 12 + '¢•*@&.;,"'

def tree(max_width):
  yield '/⁂\\'.center(max_width)

  for width in range(3, max_width - 1, 2):
    row = '/'
    for _ in range(width):
        row += choice(CELLS)
    row += '\\'
    yield row.center(max_width)

  yield "'|  |'".center(max_width)
  yield " |  | ".center(max_width)
  yield '-' * max_width
  title = b'SGFwcHkgTmV3IFllYXIsIEBweXRob25ldGMh'
  yield b64decode(title).decode().center(max_width)

for row in tree(40):
  print(row)