Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import random
- LETTERS="""..####...#####....####...#####...######..######...####...##..##..######..######..##..##..##......##...##..##..##...####...#####....####...#####....####...######..##..##..##..##..##...##..##..##..##..##..######.
- .##..##..##..##..##..##..##..##..##......##......##......##..##....##........##..##.##...##......###.###..###.##..##..##..##..##..##..##..##..##..##........##....##..##..##..##..##...##...####....####......##..
- .######..#####...##......##..##..####....####....##.###..######....##........##..####....##......##.#.##..##.###..##..##..#####...##.###..#####....####.....##....##..##..##..##..##.#.##....##......##......##...
- .##..##..##..##..##..##..##..##..##......##......##..##..##..##....##....##..##..##.##...##......##...##..##..##..##..##..##......##..##..##..##......##....##....##..##...####...#######...####.....##.....##....
- .##..##..#####....####...#####...######..##.......####...##..##..######...####...##..##..######..##...##..##..##...####...##.......#####..##..##...####.....##.....####.....##.....##.##...##..##....##....######.
- ..................................................................................................................................................................................................................""".split("\n")
- INLINES=np.array([*map(lambda x:[ 1 if l=='#' else 0 for l in x],LETTERS)])
- def upscale(ascii,f=2):
- res=[]
- for l in ascii:
- twice=[]
- for x in l:
- twice+=[x]*f
- for _ in range(f):
- res.append(twice)
- return res
- WORD="PUTALLUPPERCASELETTERSHERE"
- def getAsciiArt(l):
- cellStart=(ord(l)-ord('A'))*8
- return INLINES[:,cellStart:cellStart+8]
- TEST=getAsciiArt("A")
- for l in upscale(TEST,3):
- print(l)
- M=10**10
- T=10**10
- MAX_SCALE=2
- #random position fpr each letter
- P_SHIFTS=[(random.randint(0,M),random.randint(0,M)) for _ in range(len(WORD))]
- # random 'intersection' time for each letter
- T_SHIFTS=sorted([random.randint(1,T) for _ in range(len(WORD))])
- # random scale for each letter
- SCALE=[random.randint(1,MAX_SCALE) for _ in range(len(WORD))]
- ALL_LETTERS=[]
- for p,t,l,s in zip(P_SHIFTS,T_SHIFTS,WORD,SCALE):
- ccc=[]
- px,py=p
- zzz=upscale(getAsciiArt(l),s)
- rands = [*range(-90,0), *range(1,100)]
- for y,line in enumerate(zzz):
- for x,c in enumerate(line):
- vx,vy = (random.choice(rands) for _ in range(2))
- if c:
- ccc.append(((x+px,y+py),(vx,vy)))
- else:
- print(c)
- Q=t
- ALL_LETTERS += [((x+Q*a,y+Q*b),(a,b)) for (x,y),(a,b) in ccc]
- from random import shuffle
- shuffle(ALL_LETTERS)
- ALL_LETTERS_STRING = '\n'.join(f"position=<{x}, {y}> velocity=<{-vx}, {-vy}>" for (x,y),(vx,vy) in ALL_LETTERS)
- with open("gout_mix_large.txt","w") as f:
- f.write(ALL_LETTERS_STRING)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement