-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjuego.rb
36 lines (34 loc) · 1.03 KB
/
juego.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
valor = ARGV[0].downcase
unless valor == 'piedra' || valor == 'papel' || valor == 'tijera'
puts ('recuerda que es piedra papel o tijera')
else
pc = Random.rand (0..2)
if valor == 'piedra' && pc == 0
puts ('el pc jugo piedra')
puts('empate')
elsif valor == 'piedra' && pc == 1
puts ('el pc jugo papel')
puts ('perdi')
elsif valor == 'piedra' && pc == 2
puts ('el pc jugo tijera')
puts ('gane')
elsif valor == 'papel' && pc == 0
puts ('el pc jugo piedra')
puts('gane')
elsif valor == 'papel' && pc == 1
puts ('el pc jugo papel')
puts ('empate')
elsif valor == 'papel' && pc == 2
puts ('el pc jugo tijera')
puts ('perdi')
elsif valor == 'tijera' && pc == 0
puts ('el pc jugo piedra')
puts('perdi')
elsif valor == 'tijera' && pc == 1
puts ('el pc jugo papel')
puts ('gane')
elsif valor == 'tijera' && pc == 2
puts ('el pc jugo tijera')
puts ('empate')
end
end