Skip to content

Instantly share code, notes, and snippets.

@ppworks

ppworks/amida.rb

Created Jun 2, 2012
Embed
What would you like to do?
minatork01 amidakuji
#!/usr/bin/env ruby
num = ARGV[0].to_i
# header
header = 'A'
print ' '
headers = []
num.times do|i|
headers << ([header.bytes.to_a[0] + i]).pack('U*')
end
print headers.join ' '
puts ' '
# body
(5 + rand(20)).times do|i|
print ' '
index = rand(num)
num.times do|j|
print '|'
unless j == (num - 1)
if j == index
print '---'
else
print ' '
end
end
end
puts ' '
end
# footer
footers = []
num.times do|i|
footers << ' '
end
footers[rand(num)] = '!!!'
puts footers.join ' '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.