Advertisement
Guest User

big boi gen

a guest
Dec 10th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. import numpy as np
  2. import random
  3. LETTERS="""..####...#####....####...#####...######..######...####...##..##..######..######..##..##..##......##...##..##..##...####...#####....####...#####....####...######..##..##..##..##..##...##..##..##..##..##..######.
  4. .##..##..##..##..##..##..##..##..##......##......##......##..##....##........##..##.##...##......###.###..###.##..##..##..##..##..##..##..##..##..##........##....##..##..##..##..##...##...####....####......##..
  5. .######..#####...##......##..##..####....####....##.###..######....##........##..####....##......##.#.##..##.###..##..##..#####...##.###..#####....####.....##....##..##..##..##..##.#.##....##......##......##...
  6. .##..##..##..##..##..##..##..##..##......##......##..##..##..##....##....##..##..##.##...##......##...##..##..##..##..##..##......##..##..##..##......##....##....##..##...####...#######...####.....##.....##....
  7. .##..##..#####....####...#####...######..##.......####...##..##..######...####...##..##..######..##...##..##..##...####...##.......#####..##..##...####.....##.....####.....##.....##.##...##..##....##....######.
  8. ..................................................................................................................................................................................................................""".split("\n")
  9.  
  10. INLINES=np.array([*map(lambda x:[ 1 if l=='#' else 0 for l in x],LETTERS)])
  11.  
  12. def upscale(ascii,f=2):
  13. res=[]
  14. for l in ascii:
  15. twice=[]
  16. for x in l:
  17. twice+=[x]*f
  18. for _ in range(f):
  19. res.append(twice)
  20. return res
  21.  
  22. WORD="PUTALLUPPERCASELETTERSHERE"
  23. def getAsciiArt(l):
  24. cellStart=(ord(l)-ord('A'))*8
  25. return INLINES[:,cellStart:cellStart+8]
  26.  
  27. TEST=getAsciiArt("A")
  28. for l in upscale(TEST,3):
  29. print(l)
  30.  
  31. M=10**10
  32. T=10**10
  33. MAX_SCALE=2
  34. #random position fpr each letter
  35. P_SHIFTS=[(random.randint(0,M),random.randint(0,M)) for _ in range(len(WORD))]
  36. # random 'intersection' time for each letter
  37. T_SHIFTS=sorted([random.randint(1,T) for _ in range(len(WORD))])
  38. # random scale for each letter
  39. SCALE=[random.randint(1,MAX_SCALE) for _ in range(len(WORD))]
  40. ALL_LETTERS=[]
  41. for p,t,l,s in zip(P_SHIFTS,T_SHIFTS,WORD,SCALE):
  42. ccc=[]
  43. px,py=p
  44. zzz=upscale(getAsciiArt(l),s)
  45. rands = [*range(-90,0), *range(1,100)]
  46. for y,line in enumerate(zzz):
  47. for x,c in enumerate(line):
  48. vx,vy = (random.choice(rands) for _ in range(2))
  49. if c:
  50. ccc.append(((x+px,y+py),(vx,vy)))
  51. else:
  52. print(c)
  53. Q=t
  54. ALL_LETTERS += [((x+Q*a,y+Q*b),(a,b)) for (x,y),(a,b) in ccc]
  55. from random import shuffle
  56. shuffle(ALL_LETTERS)
  57. ALL_LETTERS_STRING = '\n'.join(f"position=<{x}, {y}> velocity=<{-vx}, {-vy}>" for (x,y),(vx,vy) in ALL_LETTERS)
  58. with open("gout_mix_large.txt","w") as f:
  59. f.write(ALL_LETTERS_STRING)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement