Created
June 2, 2012 10:09
-
-
Save asflash8/2857651 to your computer and use it in GitHub Desktop.
みなとRuby会議01 ソーシャルコーディング あみだくじ
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 characters
person_num = ARGV.first.to_i | |
person_names = ('A'..'Z').to_a | |
height = 10 | |
person_num.times do |p| | |
print "#{person_names[p]} " | |
end | |
puts | |
height.times do |n| | |
line_display_num = rand(person_num -1) | |
person_num.times do |p| | |
if p == line_display_num | |
print '|---' | |
else | |
print '| ' | |
end | |
end | |
puts | |
end | |
hit_num = rand(person_num) | |
person_num.times do |p| | |
if p == hit_num | |
print "!!! " | |
else | |
print " " | |
end | |
end | |
puts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
おおお、うれしい!
横線は行でひとつはたしかに少ないですね…
コードを読んで勉強します!