ใ๐ฐๅๅฟ่ ใRubyใฎใใฃใกๅใใฆใใคใขใใชใไธๆใๅฎ่กใใใชใ
่งฃๆฑบใใใใใจ
Rubyใงไฝๆใใใใฃใกๅใใฆใใคใขใใชใๅฎ่กใใใจใใใไธๆใ่กใใชใ้จๅใใใใพใใใ
โ ใกใฝใใใjankenใใฎ็ตๆใ็ๅฝๅคใง่ฟใใๅๆใใคใใพใงใซใผใใใใใใใ้ใฎ็ตๆใจใชใฃใฆใใพใใ๏ผใใใใฎๆใซใใฃใกๅใใฆใใคใซ้ฒใใๅใคOR่ฒ ใใฎๆใซใซใผใใใ๏ผ
โกใใใใใใงๅใฃใฆใ่ฒ ใใฆใใใใฃใกๅใใฆใใคใฎ็ตๆๅใๆนๅใๅใใๅ ดๅใ่ฒ ใใใจๅคๅฎใใใฆใใพใใ
putsๆใๅ
ฅใใฆ็ขบ่ชใใใจใใtrue/falseใฎๅคๅฎใฏๆญฃใใๅบใฆใใใจๆใใฎใงใใใใชใใใใชใฃใฆใใพใใฎใงใใใใใ
ไปฅไธใณใผใใฏใใใใใใกใฝใใใจใใฃใกๅใใฆใใคใกใฝใใใซๅใใฆๆธใใฆใใใพใใ
ๅฎ่ก็ตๆ
ใณใผใ
require "csv"
puts"------------------------------"
puts"ใใฃใกๅใใฆใใคใฒใผใ ใๅงใใพใใ"
def janken
puts "ใใใใใใปใปใป"
puts "0(ใฐใผ)1(ใใงใญ)2(ใใผ)3(ๆฆใใชใ)"
select_number = gets.to_i
if !(select_number == 0 || select_number == 1 || select_number ==2)
select_number = 3
end
random_number = rand(3)
jankens = ["ใฐใผ","ใใงใญ","ใใผ","ๆฆใใชใ"]
puts "ใใชใ๏ผ#{jankens[select_number]} ็ธๆ๏ผ#{jankens[random_number]}"
puts"------------------------------"
if select_number ==3 || random_number == 3
puts"ใใใใใใๆพๆฃใใใพใใใใฒใผใ ใ็ตไบใใพใใ"
exit
end
number = select_number - random_number
if number == 0
puts "ใใใใงใใใใไธๅบฆใใใใใใใใพใใ"
false
elsif number == 1 || number == -2
puts"ใใใใใใซ่ฒ ใใพใใใใใฃใกใใใฆใปใปใป"
true
elsif number == -1 || number == 2
puts "ใใใใใใซๅใกใพใใใใใฃใกใใใฆใปใปใป"
true
end
end
loop do
f1 = janken
break if f1
end
def acchimuite_hoi
puts "0(ไธ)1(ไธ)2(ๅทฆ)3(ๅณ)"
select_number2 = gets.to_i
random_number2 =rand(3)
directions = ["ไธ","ไธ","ๅทฆ","ๅณ"]
puts"ใใค๏ผ"
puts "ใใชใ๏ผ#{directions[select_number2]} ็ธๆ๏ผ#{directions[random_number2]}"
puts"------------------------------"
if select_number2 == random_number2
true
else
false
end
end
f1 = janken
loop do
f2 = acchimuite_hoi
break if f2
end
if f1
puts"ใใชใใฎๅใกใงใ๏ผใใใงใจใ"
else
puts"ๆฎๅฟตใปใปใปใใชใใฎ่ฒ ใใงใ"
end