Created
June 2, 2012 05:18
-
-
Save hokkai7go/2856714 to your computer and use it in GitHub Desktop.
minatork01_socialcoding_example1
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
@data = Array.new() | |
Num = 5 | |
Height = 10 | |
Not_line = " " | |
Line = "---" | |
def make_data | |
Height.times do |h| | |
@data << make_line(Num) | |
end | |
end | |
def make_line(num) | |
line = "" | |
written = false | |
(num-1).times do |n| | |
line_maker = rand() | |
if(line_maker < 0.4 && !written) | |
line += ("|" + Line) | |
written = true | |
else | |
line += ("|" + Not_line) | |
written = false | |
end | |
end | |
line += "|" | |
line | |
end | |
def output | |
# name of member | |
Num.times {|n| print "#{n} "} | |
puts "" | |
@data.each {|d| puts d} | |
# あたり | |
hit = rand(Num) | |
# あたりの場所に!を出す | |
hit.times {|h| print " " } | |
puts "!" | |
end | |
make_data | |
output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@hamaknさんとペアプロしましたー
楽しかったー。またやりたい