Created
April 15, 2017 18:57
-
-
Save kolen/d50153dc9e072db4886760b19b2b26aa to your computer and use it in GitHub Desktop.
This file contains 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 ruby | |
colors = [160, 88, 2, 40, 2, 40, 2, 40] | |
def circle(color) | |
STDOUT.write "\e[38;5;#{color}m⬤ " | |
end | |
def space | |
STDOUT.write ' ' | |
end | |
def clear | |
puts "\e[2J" | |
end | |
clear | |
[0.1, 0.3, 0.5, 0.7, 1.0, 1.0, 1.0].each do |prob| | |
40.times do | |
rand < prob ? circle(colors.sample) : space | |
end | |
puts '' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment