Created
July 11, 2018 15:00
-
-
Save andrewgiessel/0c9c2f23c7463a0fda4a583d84318930 to your computer and use it in GitHub Desktop.
stars.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import numpy as np | |
ship = '🚀' | |
chars = [' ', '·', '.', '*', '✵', '✫', '+', '⋆', '✺', '.', '✧', '✦', '˚'] | |
probs = [ 0.58247423+0.23969072, 0.05927835, 0.04896907, 0.02061856, | |
0.0128866 , 0.01030928, 0.00515464, 0.00515464, 0.00515464, | |
0.00257732, 0.00257732, 0.00257732, 0.00257732] | |
num_lines = 5 | |
star_line = np.random.randint(0,num_lines) | |
star_spot = np.random.randint(0,80) | |
lines = [''.join(np.random.choice(chars, size=80, p=probs)) for _ in range(num_lines)] | |
for i, l in enumerate(lines): | |
if i == star_line: | |
print(l[:star_spot-1]+ship+l[star_spot:]) | |
else: | |
print(l) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment