Skip to content

Instantly share code, notes, and snippets.

@hokkai7go
Created June 2, 2012 05:18
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 hokkai7go/2856714 to your computer and use it in GitHub Desktop.
Save hokkai7go/2856714 to your computer and use it in GitHub Desktop.
minatork01_socialcoding_example1
@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
@hokkai7go
Copy link
Author

@hamaknさんとペアプロしましたー
楽しかったー。またやりたい

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment