Skip to content

Instantly share code, notes, and snippets.

@jacopen
Created November 2, 2012 11:41
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 jacopen/4000599 to your computer and use it in GitHub Desktop.
Save jacopen/4000599 to your computer and use it in GitHub Desktop.
ikeda-y & jacopen amida ver1.0 2012/11/2
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