Newer
Older
Ruby / rosian.rb
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

def time
  i=5
  while i>0
    sleep 1
    i=i-1
  end
end
def setumei
  puts("",time)
  puts("まず、ロシアンルーレットのルール説明をさせていただきます。")
  puts("",time)
  puts("このゲームは普通のロシアンルーレットと違う点があります。")
  puts("",time)
  puts("それは一回銃を撃つたびに銃の弾を一発ずつ増やすということと、撃つ側と撃たれる側を毎回決めるということです。")
  puts("",time)
  puts("つまり、六回目に撃つときは必ず撃たれる側が負けるということです。")
  puts("",time)
  puts("ではルール説明は以上です。早速開始しましょう!")
end
def first
  puts("",time)
  puts("現在弾倉に入っている弾数は一発です。")
  puts("",time)
  zyunban=[]
  zyunban<<"先攻"
  zyunban<<"後攻"
  a=rand(2)
  if a==0
    puts("貴方は撃つ側です!")
    puts("",time)
    tama1=[]
    tama1<<"当たり"
    tama1<<"外れ"
    tama1<<"外れ"
    tama1<<"外れ"
    tama1<<"外れ"
    tama1<<"外れ"
    a=rand(6)
    if a==0
      puts("バンッ!")
      puts("",time)
      puts("貴方の勝ちです!おめでとうございます!")
    else
      puts("残念!外れですね!")
    end
  elsif a==1
    puts("貴方は撃たれる側です!")
    puts("",time)
    tama1=[]
    tama1<<"当たり"
    tama1<<"外れた"
    tama1<<"外れた"
    tama1<<"外れた"
    tama1<<"外れた"
    tama1<<"外れた"
    a=rand(6)
    if a==0
      puts("バンッ!")
      puts("",time)
      puts("…貴方の負けです。")
    else
      puts("外れです!良かったですね!")
    end
  end
end
def second
  puts("",time)
  puts("現在弾倉に入っている弾数は二発です。")
  puts("",time)
  zyunban=[]
  zyunban<<"先攻"
  zyunban<<"後攻"
  b=rand(2)
  if b==0
    puts("貴方は撃つ側です!")
    puts("",time)
    tama2=[]
    tama2<<"当たり"
    tama2<<"当たり"
    tama2<<"外れ"
    tama2<<"外れ"
    tama2<<"外れ"
    tama2<<"外れ"
    b=rand(6)
    if b==0
      puts("バンッ!")
      puts("",time)
      puts("貴方の勝ちです!おめでとうございます!")
    elsif b==1
      puts("バンッ!")
      puts("",time)
      puts("貴方の勝ちです!おめでとうございます!")
    else
      puts("残念!外れですね!")
    end
  elsif b==1
    puts("貴方は撃たれる側です!")
    puts("",time)
    tama2=[]
    tama2<<"当たり"
    tama2<<"当たり"
    tama2<<"外れ"
    tama2<<"外れ"
    tama2<<"外れ"
    tama2<<"外れ"
    b=rand(6)
    if b==0
      puts("バンッ!")
      puts("",time)
      puts("…貴方の負けです。")
    elsif b==1
      puts("バンッ!")
      puts("",time)
      puts("…貴方の負けです。")
    else
      puts("外れです!良かったですね!")
    end
  end
end
def third
  puts("",time)
  puts("現在弾倉に入っている弾数は三発です。")
  puts("",time)
  zyunban=[]
  zyunban<<"先攻"
  zyunban<<"後攻"
  c=rand(2)
  if c==0
    puts("貴方は
  
  
     








    
puts("では今からロシアンルーレットを開始します。")
puts("",setumei)
puts("",first)
puts("",second)