Created
November 2, 2012 11:41
-
-
Save jacopen/4000599 to your computer and use it in GitHub Desktop.
ikeda-y & jacopen amida ver1.0 2012/11/2
This file contains 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 characters
width = ARGV[0].to_i | |
height = 6 | |
margin = 3 | |
goal = rand(100) % width.to_i | |
header_list = %w(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) | |
spacer = '' | |
#fixme! | |
margin.times do |s| | |
spacer = spacer + ' ' | |
end | |
header = header_list[0..width - 1].join(spacer) | |
row = [] | |
height.times do |i| | |
row[i] = [] | |
width.times do |j| | |
row[i].push("|") | |
row[i].push(spacer) if j != width - 1 | |
end | |
row[i][(rand(100) % (width - 1).to_i) * 2 + 1] = "---" | |
end | |
puts header | |
row.each do |line| | |
puts line.join() | |
end | |
last = [] | |
width.times do |j| | |
last.push(" ") | |
last.push(spacer) if j != width - 1 | |
end | |
last[goal * 2] = "!" | |
puts last.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment