Buscar

EP 02 Beta 02 TestPlay

Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original

f1 = '''+------------+
 | |
 | |
 | |
 | | 
 - |
 |
 |
 |
 |
 |
==========================='''
f2 = '''+------------+
 | |
 | |
 | |
 | | 
 - |
 0 |
 |
 |
 |
 |
=========================='''
f3 = '''+------------+
 | |
 | |
 | |
 | | 
 - |
 0 |
 | |
 |
 |
 |
=========================='''
f4 = '''+------------+
 | |
 | |
 | |
 | | 
 - |
 0 |
 /| |
 |
 |
 |
=========================='''
f5 = '''+------------+
 | |
 | |
 | |
 | | 
 - |
 0 |
 /|\ |
 |
 |
 |
=========================='''
f6 = '''+------------+
 | |
 | |
 | |
 | | 
 - |
 0 |
 /|\ |
 / |
 |
 |
=========================='''
f7 = '''+------------+
 | |
 | |
 | |
 | | 
 - |
 0 | 
 /|\ | 
 / \ | 
 | 
 | 
=========================='''
lista = [f1, f2, f3, f4, f5, f6, f7]
certas = ""
erradas = ""
palavras = ""
a = ""
b = ""
n = 0
dg = 0
def escolhe():
 import urllib.request
 import random
 global a
 global b
 global n
 pagina = ((urllib.request.urlopen("http://bit.ly/babynamesEP2")).read().decode('utf8').split())
 for k in range(len(pagina)):
 if k % 3 != 0:
 a = a + pagina[k]
 if k % 3 == 0:
 a = a + " "
 a = a.split()
 n = random.randint(0, 119)
 b = b + a[n]
 b = b.lower()
def desenha():
 global b
 global certas
 global erradas
 print(lista[(len(erradas))])
 j = ""
 b = list(b)
 for k in b:
 if k in certas:
 j = j + k
 else:
 j = j + "_ "
 return j 
def chute(letra):
 global b
 global certas
 global erradas
 global palavras
 if letra.lower() not in "abcdefghijklmnopqrstuvxwyz":
 return "Não é letra"
 if (letra.lower() in erradas) or (letra.lower() in certas):
 return "Letra repetida"
 if len(letra.lower()) != 1:
 return "Muitas letras" 
 if letra.lower() not in b:
 erradas = erradas + letra.lower()
 if letra.lower() in b:
 certas = certas + letra.lower()
 if len(erradas) >= 6:
 return ganhou()
 if (len(certas) == len(set((b)))) and (bool(certas) == True):
 return ganhou()
 return letra
def jogar_novamente():
 global certas
 global erradas
 global palavras
 global a
 global b
 global n
 global dg
 j = input("Jogar de novo ?: ")
 if (j.lower()) in "sim":
 certas = ""
 erradas = ""
 palavras = ""
 a = ""
 b = ""
 n = 0
 dg = 0
 return começar()
 if (j.lower()) in "naonão":
 return "Fim"
 else:
 return jogar_novamente() 
def ganhou():
 global certas
 global erradas
 global dg
 dg = 1
 if (len(erradas) < 6) and (len (certas) == len (set((b)))) and (bool(certas) == True):
 return "Ganhou"
 else:
 return "Perdeu"
def começar():
 escolhe()
 while dg == 0:
 digita = str(input("Digite: "))
 print (" ")
 print (chute(digita))
 print (desenha())
 print (" ")
 if dg == 1:
 print (jogar_novamente())
começar()

Teste o Premium para desbloquear

Aproveite todos os benefícios por 3 dias sem pagar! 😉
Já tem cadastro?

Continue navegando

Outros materiais