Newer
Older
Ruby / p.rb
@ABE Koshun ABE Koshun on 20 Dec 2021 671 bytes 2021-12-20 20:55:49
#!/usr/bin/env ruby
# coding: utf-8
te=["グー","チョキ","パー"]
puts"Enterを押すと始まるよ!"
gets

while true
  print("最初はグー、ジャンケンポン!:")
  a=gets.chomp
srand()
  x = rand(te)
  printf("コンピューターは%sを出しました!\n",te)
  if a="グー"and x="チョキ"or a="チョキ"and x="パー"or a="パー"and x="グー"
    puts"勝ちました!"
    break
  elsif a="グー"and x="グー"or a="チョキ"and x="チョキ"or a="パー"and x="パー"
    puts"あいこ!"
    redo
  elsif a="グー"and x="パー"or a="チョキ"and x="グー"or a="パー"and x="チョキ"
    puts"負けました..."
    break
  end
end