Skip to content

Instantly share code, notes, and snippets.

@ppworks
Created June 2, 2012 05:14
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 ppworks/2856702 to your computer and use it in GitHub Desktop.
Save ppworks/2856702 to your computer and use it in GitHub Desktop.
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