Repository navigation
Expand file tree
/
Copy pathex045 JOKENPO.py
More file actions
82 lines (80 loc) · 2.29 KB
/
Copy pathex045 JOKENPO.py
File metadata and controls
82 lines (80 loc) · 2.29 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
''' Crie um programa que faça o computador jogar Jokenpô com você'''
'''color = {"br": "\033[0;30m", "vm": "\033[0;31m", "vd": "\033[0;32m", "am": "\033[0;33m",
"az": "\033[0;34m", "rx": "\033[0;35m", "cn": "\033[0;36m", "cz": "\033[0;37m",
"cls": "\033[m", "bd": "\033[1m", "un": "\033[4m", "ng": "\033[7m"}
from time import sleep
from random import shuffle
print("{:=^40}".format("JOGO DE JOKENPÔ"))
cpu = ["PEDRA", "PAPEL", "TESOURA"]
jog = str(input("\nSuas opções: "
"\nPEDRA"
"\nPAPEL"
"\nTESOURA"
"\nQual a sua escolha? ")).upper()
shuffle(cpu)
print("JO")
sleep(1)
print("KEN")
sleep(1)
print("PÔ!")
if cpu[0] == jog:
res = 2
elif cpu[0] == "PEDRA" and jog == "TESOURA":
res = 0
elif cpu[0] == "PEDRA" and jog == "PAPEL":
res = 1
elif cpu[0] == "PAPEL" and jog == "PEDRA":
res = 0
elif cpu[0] == "PAPEL" and jog == "TESOURA":
res = 1
elif cpu[0] == "TESOURA" and jog == "PAPEL":
res = 0
elif cpu[0] == "TESOURA" and jog == "PEDRA":
res = 1
print("-="*20, "\nO computador jogou {}!\nO jogador jogou {}".format(cpu[0], jog))
print("-="*20)
if res == 2:
print("Isso resulta em um EMPATE!")
elif res == 1:
print("O JOGADOR VENCEU!!")
else:
print("O JOGADOR PERDEU!!")
'''
from random import randint
from time import sleep
jogada = ("PEDRA", "PAPEL", "TESOURA")
cpu = randint(0,2)
jog = int(input("\nSuas opções: "
"\n[ 0 ] PEDRA"
"\n[ 1 ] PAPEL"
"\n[ 2 ] TESOURA"
"\nQual a sua escolha? "))
if jog > 2:
print("Você selecionou uma opção inválida, tente novamente!")
quit()
print("JO")
sleep(1)
print("KEN")
sleep(1)
print("PÔ!")
print("-="*20, "\nO computador jogou {}!\nO jogador jogou {}".format(jogada[cpu], jogada[jog]))
print("-="*20)
if jogada[cpu] == jogada[jog]:
print("Isso resulta em um EMPATE!")
elif cpu == 0:
if jog == 1:
print("O JOGADOR VENCEU!!")
if jog == 2:
print("O JOGADOR PERDEU!!")
elif cpu == 1:
if jog == 0:
print("O JOGADOR PERDEU!!")
if jog == 2:
print("O JOGADOR VENCEU!!")
elif cpu == 2:
if jog == 0:
print("O JOGADOR VENCEU!!")
if jog == 1:
print("O JOGADOR PERDEU!!")
else:
print("Você digitou uma opção inválida!")