Pandaaaa906

Untitled

Dec 21st, 2021 (edited)
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. d = {
  2.     0: (1,(1,1),0,(1,1),1),
  3.     1: (0,(0,1),0,(0,1),0),
  4.     2: (2,(0,1),1,(1,0),1),
  5.     3: (1,(0,1),1,(0,1),1),
  6.     4: (0,(1,1),1,(0,1),0),
  7.     5: (1,(1,0),1,(0,1),1),
  8. }
  9.  
  10. DOT = "*"
  11. LINE = "|"
  12. SPACE = " "
  13. CHAR_SPACE_SIZE = 4
  14. CHAR_SPACE = SPACE * CHAR_SPACE_SIZE
  15. BASE_WIDTH = 2
  16.  
  17.  
  18. def draw_layer(num, size, layer):
  19.     num_setting = d[num]
  20.     if layer in {0, 2, 4}:
  21.         return f'{SPACE}{(DOT if num_setting[layer] else SPACE)*BASE_WIDTH*size}{SPACE}'
  22.     return f'{LINE if num_setting[layer][0] else SPACE}' \
  23.            f'{SPACE * BASE_WIDTH * size}' \
  24.            f'{LINE if num_setting[layer][1] else SPACE}'
  25.  
  26.  
  27. def draw(nums, size):
  28.     print(f"printing {nums}, with size {size}")
  29.     for layer in range(5):
  30.         n = 1 if layer in {0, 2, 4} else size
  31.         for i in range(n):
  32.             print(CHAR_SPACE.join(draw_layer(num, size, layer) for num in nums))
  33.  
  34.  
  35. if __name__ == '__main__':
  36.     draw([0, 1, 2, 3, 4, 5], 3)
  37.  
Add Comment
Please, Sign In to add comment