Skip to content

Instantly share code, notes, and snippets.

@yuryofujita
Created June 2, 2012 16:11
Show Gist options
  • Save yuryofujita/2858993 to your computer and use it in GitHub Desktop.
Save yuryofujita/2858993 to your computer and use it in GitHub Desktop.
あみだくじ みなとRuby会議01
class Amida
def amida_def()
base1 = "| "
base2 = "|---"
base3 = ""
y="|"
records = Array.new(5,base1)
flg = 0
records.each do |elem|
x1 = rand(2)
if x1 == 0 then
if flg == 0 then
#
base3 << base2
flg =1
else
base3 << elem
end
else
base3 << elem
end
end
p base3
end
end
title = Array.new
title << " A "
title << " B "
title << " C "
title << " D "
title << " E"
print title
puts ""
amida = Amida.new
amida.amida_def()
for num in 1..8 do
amida.amida_def()
end
atari1 = " "
atari2 = "!!! "
atari3 = ""
aRecords = Array.new(5,atari1)
flg = 0
aRecords.each do |elem|
x1 = rand(2)
if x1 == 0 then
if flg == 0 then
#
atari3 << atari2
flg =1
else
atari3 << elem
end
else
atari3 << elem
end
end
p atari3
@yuryofujita
Copy link
Author

■みなとRuby会議01の課題
あみだくじコンソールアプリ
・あたりの数は一つ
・横線がランダムに配置されること。
・横線の数>0
・横線が複数繋がってはいけない。
・人数(例の場合A〜Bの5人)の指定ができるようにする。

リファクタリングなしで汚いコードだけどw

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