Skip to content

Instantly share code, notes, and snippets.

@kolen
Created April 15, 2017 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kolen/d50153dc9e072db4886760b19b2b26aa to your computer and use it in GitHub Desktop.
Save kolen/d50153dc9e072db4886760b19b2b26aa to your computer and use it in GitHub Desktop.
#!/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