Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Sierpinski Triangle in Ruby (See related posts)

# From: http://gilesbowkett.blogspot.com/2008/04/ruby-golf-ascii-sierpinski-triangle.html
# Author: Brain Mitchell

# For wide terminals:
ruby -le '64.times{|y|print" "*(63-y),(0..y).map{|x|~y&x>0?" .":" A"}}'

# For thin terminals:
ruby -le '32.times{|y|print" "*(32-y),(0..y).map{|x|~y&x>0?" .":" A"}}'

You need to create an account or log in to post comments to this site.


Click here to browse all 6643 code snippets

Related Posts