Created
June 13, 2017 07:24
-
-
Save ernestas-poskus/8830471689b257af6c386af85549f852 to your computer and use it in GitHub Desktop.
Revisions
-
ernestas-poskus created this gist
Jun 13, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ m = [] size = 15 def shards(s, r) s * r + s end size.times { |y| m << Array(0..size).map { |x| shards(y, x) }.join(' | ') } print '| ' size.times { |header| print "| #{header} " } puts '|' size.times { |header| print "| - " } puts '| - |' m.each_with_index do |row, index| next if index == 0 print "| #{index} | #{row} |" puts end