Newer
Older
program / janken1.rb
@houtin houtin on 7 Oct 2021 908 bytes no coment
#!/usr/bin/env ruby
# coding: utf-8
while true
  print"じゃんけんスタート!1(✊)または2(✌)または3(✋)を入力してください。"
 
 te=["1","2","3"]
  print"自分が出した手を数字で入力"
 
 # my=gets.to_i
 my = 1
  
  printf("あなたが出したのは%dです。\n",my)
  sleep(3)
 # te=rand(te.length)
 te = 1
  printf("相手が出したのは、%dです。\n",te)
  
  if my==1&&te==2||my==2&&te==3||my==3&&te==1
    print"私の勝ちです!!"
  elsif my==1&&te==3||my==2&&te==1||my==3&&te==2
    print"私の負けです😢"
  elsif my==1&&te==1||my==2&&te==2||my==3&&te==3
    print"あいこです。"
    print"その選択肢はないよ!"
    print"もう一度やりますか?"
    mouitido=gets.chomp
    if mouitido=="やる"
      redo
    elsif mouitido=="やらない"
      break 
    else puts"その選択肢はないよ"
      break 
    end
  end
end