-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoggers
More file actions
224 lines (195 loc) · 6.82 KB
/
poggers
File metadata and controls
224 lines (195 loc) · 6.82 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
import random
import time
# Lista de opcoes jogáveis (apenas as opções principais)
options = ["pedra", "papel", "tesoura"]
# Funções para o jogo
def agradecimento():
print(" OBRIGADO POR JOGAR! \n"
" feito por:\n"
" Daniel Jose\n"
" Daniel Langner\n"
" Eduardo de Oliveira\n"
" Isabelle Duarte\n "
" <3 ")
def mostrar_placar(pontplayer1, nome_jogador1, pontplayer2, nome_jogador2):
print(f"\nPlacar: {nome_jogador1} {pontplayer1} x {pontplayer2} {nome_jogador2}\n")
def game_menu():
menu_options = ["1", "2", "3"]
print("(1) VsCop \n(2) CopVsCop \n(3) 1v1")
while True:
choice = input("Selecione o modo de jogo: ")
if choice in menu_options:
return choice
else:
print("Opção inválida. Por favor, escolha 1, 2 ou 3.")
def verifica(b1, b2):
if b1 == b2:
print("Empate!")
return 0
elif (b1 == "pedra" and b2 == "tesoura") or \
(b1 == "papel" and b2 == "pedra") or \
(b1 == "tesoura" and b2 == "papel"):
print("Jogador 1 venceu!")
return 1
else:
print("Jogador 2 venceu!")
return 2
def continuar_jogo():
while True:
res = input("Deseja continuar a próxima rodada? [s/n]: ")
if res.lower() in ['s', 'sim']:
return True
elif res.lower() in ['n', 'não']:
return False
else:
print("Resposta inválida. Por favor, digite 's' para sim ou 'n' para não.")
def perguntar_novo_modo():
while True:
res = input("Quer recomeçar em outro modo? [s/n]: ")
if res.lower() in ['s', 'sim']:
return True
elif res.lower() in ['n', 'não']:
return False
else:
print("Resposta inválida. Por favor, digite 's' para sim ou 'n' para não.")
# modo player vs computador
def vs_cop_game():
pont_player = 0
pont_coop = 0
nome_jogador = "Jogador"
nome_cop = "Computador"
turn = 1
while True:
print(f"\nRodada {turn}")
print("pedra [1] ", "papel [2]", "tesoura [3]")
p1_choice_str = input("Faça sua escolha: ")
if p1_choice_str == '1':
p1 = "pedra"
elif p1_choice_str == '2':
p1 = "papel"
elif p1_choice_str == '3':
p1 = "tesoura"
elif p1_choice_str.lower() == 'q':
mostrar_placar(pont_player, nome_jogador, pont_coop, nome_cop)
return None
else:
print("Input do jogador inválido. Por favor, escolha entre 1, 2 ou 3 ou 'q' para sair.")
continue
cop1 = random.choice(options)
print(f"A escolha do jogador foi: {p1}")
print(f"A escolha do computador foi: {cop1}\n")
resultado = verifica(p1, cop1)
if resultado == 1:
pont_player += 1
elif resultado == 2:
pont_coop += 1
mostrar_placar(pont_player, nome_jogador, pont_coop, nome_cop)
if not continuar_jogo():
mostrar_placar(pont_player, nome_jogador, pont_coop, nome_cop)
if perguntar_novo_modo():
return game_menu()
else:
return None
turn += 1
# modo computador vs computador
def cop_vs_cop_game():
pont_bot1 = 0
pont_bot2 = 0
nome_bot1 = "Bot 1"
nome_bot2 = "Bot 2"
turn = 1
while True:
print(f"\nRodada {turn}")
bot1 = random.choice(options)
bot2 = random.choice(options)
print(f"{nome_bot1} escolheu: {bot1}")
print(f"{nome_bot2} escolheu: {bot2}\n")
resultado = verifica(bot1, bot2)
if resultado == 1:
pont_bot1 += 1
elif resultado == 2:
pont_bot2 += 1
mostrar_placar(pont_bot1, nome_bot1, pont_bot2, nome_bot2)
if not continuar_jogo():
mostrar_placar(pont_bot1, nome_bot1, pont_bot2, nome_bot2)
if perguntar_novo_modo():
return game_menu()
else:
return None
turn += 1
# modo pvp
def jogador_vs_jogador():
pont_player1 = 0
pont_player2 = 0
nome_jogador1 = input("Digite o nome do Jogador 1: ")
nome_jogador2 = input("Digite o nome do Jogador 2: ")
turn = 1
while True:
print(f"\nRodada {turn}")
print(f"{nome_jogador1}, escolha: pedra [1], papel [2], tesoura [3]")
p1_choice_str = input("Faça sua escolha: ")
if p1_choice_str == '1':
p1 = "pedra"
elif p1_choice_str == '2':
p1 = "papel"
elif p1_choice_str == '3':
p1 = "tesoura"
elif p1_choice_str.lower() == 'q':
mostrar_placar(pont_player1, nome_jogador1, pont_player2, nome_jogador2)
return None
else:
print("Input do jogador inválido. Por favor, escolha entre 1, 2 ou 3 ou 'q' para sair.")
continue
print(f"{nome_jogador2}, escolha: pedra [1], papel [2], tesoura [3]")
p2_choice_str = input("Faça sua escolha: ")
if p2_choice_str == '1':
p2 = "pedra"
elif p2_choice_str == '2':
p2 = "papel"
elif p2_choice_str == '3':
p2 = "tesoura"
elif p2_choice_str.lower() == 'q':
mostrar_placar(pont_player1, nome_jogador1, pont_player2, nome_jogador2)
return None
else:
print("Input do jogador inválido. Por favor, escolha entre 1, 2 ou 3 ou 'q' para sair.")
continue
print(f"A escolha de {nome_jogador1} foi: {p1}")
print(f"A escolha de {nome_jogador2} foi: {p2}\n")
resultado = verifica(p1, p2)
if resultado == 1:
pont_player1 += 1
elif resultado == 2:
pont_player2 += 1
mostrar_placar(pont_player1, nome_jogador1, pont_player2, nome_jogador2)
if not continuar_jogo():
mostrar_placar(pont_player1, nome_jogador1, pont_player2, nome_jogador2)
if perguntar_novo_modo():
return game_menu()
else:
return None
turn += 1
# Execução do jogo
while True:
game_mode = game_menu()
if game_mode == '1':
result = vs_cop_game()
if result == None:
break
elif isinstance(result, str) and result.isdigit() and result in ['1', '2', '3']:
continue
elif game_mode == '2':
result = cop_vs_cop_game()
if result == None:
break
elif isinstance(result, str) and result.isdigit() and result in ['1', '2', '3']:
continue
elif game_mode == '3':
result = jogador_vs_jogador()
if result == None:
break
elif isinstance(result, str) and result.isdigit() and result in ['1', '2', '3']:
continue
if perguntar_novo_modo() == False:
break
agradecimento()