Created
February 24, 2017 02:34
-
-
Save baesparza/40b8aa551d0880eaa2ab1b5c66ba5d03 to your computer and use it in GitHub Desktop.
EL JUEGO DE LOS AHORCADOS created by baesparza - https://repl.it/FT27/55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import time | |
class __funciones__: | |
def preparar_palabra(): | |
seleccionado = True | |
espacios_palabra = 0 | |
nueva_palabra =[] | |
menu = {1: "Elementos Quimicos.", 2: "Nombres.", 3: "Random.", 4: "Video Juegos"} | |
print("Selecione una categoria:") | |
for clave, opc in menu.items(): | |
print("{0})".format(clave), opc) | |
while (seleccionado): | |
try: | |
opcion = int(input("<1, 2, 3, 4> ")) | |
if (opcion == 1): | |
seleccionado = False | |
archivo = open("quimica.txt") | |
lista_palabras = archivo.readlines() | |
if (opcion == 2): | |
seleccionado = False | |
archivo = open("nombres.txt") | |
lista_palabras = archivo.readlines() | |
if (opcion == 3): | |
seleccionado = False | |
archivo = open("random.txt") | |
lista_palabras = archivo.readlines() | |
if (opcion == 4): | |
seleccionado = False | |
archivo = open("videojuegos.txt") | |
lista_palabras = archivo.readlines() | |
if ((opcion != 1) and (opcion != 2) and (opcion != 3) and (opcion != 4)): | |
print("Ingrese una opcion valida.") | |
except ValueError: | |
print("Ingrese el numero de la categoria.") | |
n = random.randrange(len(lista_palabras)) | |
palabra = lista_palabras[n].strip() | |
palabra = palabra.upper() | |
archivo.close() | |
for cont in range(len(palabra)): | |
if (palabra[cont] == "Á"): | |
nueva_palabra.append("A") | |
elif (palabra[cont] == "É"): | |
nueva_palabra.append("E") | |
elif (palabra[cont] == "Í"): | |
nueva_palabra.append("I") | |
elif (palabra[cont] == "Ó"): | |
nueva_palabra.append("O") | |
elif (palabra[cont] == "Ú"): | |
nueva_palabra.append("U") | |
elif (palabra[cont] == "Ñ"): | |
nueva_palabra.append("N") | |
elif (palabra[cont] == "_"): | |
nueva_palabra.append(" ") | |
else: | |
nueva_palabra.append(palabra[cont]) | |
palabra = "".join(nueva_palabra) | |
return palabra | |
def espacios_palabra(palabra): | |
contador_espacios = 0 | |
for i in range(len(palabra)): | |
if (palabra[i] == " "): | |
contador_espacios += 1 | |
return contador_espacios | |
def mensaje(contador, letras): | |
print("Te quedan ",8 - contador," intentos") | |
if (contador == 1): | |
print("╔════╗ \n║ \n║ \n║ \n╚═══════") | |
if (contador == 2): | |
print("╔════╗ \n║ O \n║ \n║ \n╚═══════") | |
if (contador == 3): | |
print("╔════╗ \n║ O \n║ ┼ \n║ \n╚═══════") | |
if (contador == 4): | |
print("╔════╗ \n║ O \n║ ┌┼ \n║ \n╚═══════") | |
if (contador == 5): | |
print("╔════╗ \n║ O \n║ ┌┼┐ \n║ \n╚═══════") | |
if (contador == 6): | |
print("╔════╗ \n║ O \n║ ┌┼┐ \n║ ┴ \n╚═══════") | |
if (contador == 7): | |
print("╔════╗ \n║ O \n║ ┌┼┐ \n║ ┌┴ \n╚═══════") | |
if (contador == 8): | |
print("╔════╗ \n║ O \n║ ┌┼┐ \n║ ┌┴┐ \n╚═══════") | |
print(letras) | |
def reintentar(): | |
reintentar = input("Quieres volver a jugar. \n<SI-NO> ") | |
reintentar = reintentar.upper() | |
if (reintentar == "SI"): | |
reintentar = True | |
else: | |
reintentar = False | |
return reintentar | |
def creditos(tiempo): | |
print() | |
print("GRACIAS POR JUGAR".center(50, "-")) | |
time.sleep(tiempo) | |
print(" _ _ \n│_/B/r1 _│\n") | |
time.sleep(tiempo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from funciones import __funciones__ as func | |
print(("EL JUEGO DE LOS AHORCADOS").center(50, "-")) | |
#Variables | |
letras = [] | |
letras_palabra = [] | |
jugar = True | |
volverJugar = True | |
vidas = 1 | |
usadas = [] | |
lista_palabras = [] | |
lista_numeros = [] | |
seleccionado = True | |
MensajeAyuda = True | |
#Procesos | |
while (volverJugar): | |
letras = [] | |
letras_palabra = [] | |
jugar = True | |
vidas = 1 | |
usadas = [] | |
Bandera = True | |
i = 0 | |
MensajeAyuda = True | |
espacios_cont = 0 | |
espacioint = 0 | |
lista_numeros = [] | |
cont = 00 | |
palabra = func.preparar_palabra() | |
espacios_cont = func.espacios_palabra(palabra) | |
for i in range(len(palabra)): | |
letras.append("_") | |
letras_palabra.append(palabra[i]) | |
if (" " == palabra[i]): | |
letras[i] = " " | |
letras_palabra[i] = " " | |
print() | |
print("".center(50, "-")) | |
func.mensaje(vidas, letras) | |
print("La palabra tiene ", (len(letras) - espacios_cont) , " letras.") | |
print() | |
while (jugar): | |
if (letras_palabra != letras): | |
if (vidas <= 7): | |
if ((MensajeAyuda) == (vidas >= 5)): | |
letra = input('Si necesitas ayuda escribe "ayuda".\nIngrese una letra o la palabra. ') | |
else: | |
letra = input("Ingrese una letra o la palabra. ") | |
letra = letra.upper() | |
if (not (letra in usadas)): | |
if (letra == "AYUDA"): | |
MensajeAyuda = False | |
bandera = True | |
lista_numeros = [str(i) for i in range(len(letras)) if (letras[i] == "_")] | |
for i in range(len(letras)): | |
if ("_" == letras[i]): | |
letras[i] = lista_numeros[cont] | |
cont += 1 | |
print() | |
print("".center(50, "-")) | |
print("Ingrese el numero del espacio de la letra que necesita.") | |
while (bandera): | |
try: | |
print(letras) | |
espacioint = int(input("<Ayuda> ")) | |
espaciosrt = str(espacioint) | |
if (espaciosrt in letras): | |
bandera = False | |
else: | |
print("Numero fuera de rango, ingrese otro numero.") | |
except ValueError: | |
print("Ingrese solo el numero del espacio.") | |
for k in range(len(letras)): | |
if (espaciosrt == letras[k]): | |
letras[k] = palabra[k] | |
for j in range(len(letras)): | |
if (letras[j] in lista_numeros): | |
letras[j] = "_" | |
elif (len(letra) == len(palabra)): | |
if (letra in palabra): | |
jugar = False | |
print("*************HAS GANADO************* \nLa palabra correcta era",palabra) | |
Bandera = False | |
elif (len(letra) == 1): | |
if (letra in palabra): | |
for i in range(len(palabra)): | |
if (letra == palabra[i]): | |
letras[i] = letra | |
else: | |
vidas += 1 | |
print("La letra",letra,"es incorrecta, has perdido una vida.") | |
elif ((len(letra) > 1) == (len(letra) != (len(palabra)))): | |
print("Ingrese solo una letra a la vez.") | |
else: | |
vidas += 1 | |
print("Esa no es la palabra, has perdido una vida.") | |
if(Bandera): | |
func.mensaje(vidas, letras) | |
usadas.append(letra) | |
else: | |
print("La letra",letra,"ya ha sido usada.") | |
else: | |
jugar = False | |
print("Te has quedado sin intentos.\nLa palabra correcta era",palabra) | |
else: | |
print("**********HAS GANADO********** \nLa palabra correcta era",palabra) | |
jugar = False | |
print() | |
volverJugar = func.reintentar() | |
print() | |
func.creditos(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BRUNO | |
EDUARDO | |
JONATHAN | |
JORGE | |
LUIS | |
FREDI | |
MARCO | |
DAVID | |
OSCAR | |
JOSE | |
EMMANUEL | |
KERLY | |
MAYRA | |
ALAN | |
JORDY | |
MARIO | |
Alberto | |
Fernando | |
Daniela | |
Génesis | |
Laura | |
Oscar | |
Paul | |
Javier | |
José | |
Antonio | |
Vanessa | |
Lizbeth | |
Diego | |
Recorvan | |
Mercedes | |
Abigail | |
Cinthya | |
Manuel | |
Homero | |
Víctor | |
Pablo | |
González | |
Richard | |
Sandra | |
Rosa | |
Katherine | |
Valeria | |
Alexandre | |
Domenica | |
Evelyn | |
Michelle | |
Londres | |
Vicente | |
Oswaldo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HIDROGENO | |
HELIO | |
LITIO | |
BERILIO | |
BORO | |
CARBONO | |
NITROGENO | |
OXIGENO | |
FLUOR | |
NEON | |
SODIO | |
MAGNESIO | |
ALUMINIO | |
SILICIO | |
FOSFORO | |
AZUFRE | |
CLORO | |
ARGON | |
POTASIO | |
CALCIO | |
ESCANDIO | |
TITANIO | |
VANADIO | |
CROMO | |
MANGANESO | |
HIERRO | |
COBALTO | |
NIQUEL | |
COBRE | |
ZINC | |
GALIO | |
GERMANIO | |
ARSENICO | |
SELENIO | |
BROMO | |
KRIPTON | |
RUBIDIO | |
ESTRONCIO | |
ITRIO | |
ZIRCONIO | |
NIOBIO | |
MOLIBDENO | |
TECNECIO | |
RUTENIO | |
RODIO | |
PALADIO | |
PLATA | |
CADMIO | |
INDIO | |
ESTAÑO | |
ANTIMONIO | |
TELURIO | |
YODO | |
XENON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TELEVISOR | |
COMPUTADORA | |
LAPTOP | |
CAMA | |
SOFA | |
CONTROL | |
TECLADO | |
MESA | |
MAQUINA | |
SECADORA | |
LICUADORA | |
ESCRITORIO | |
BANCO | |
CABELLO | |
OJOS | |
CELULAR | |
TIJERA | |
SILLON | |
CARRO | |
ALFOMBRA | |
HELADO | |
CARTON | |
MUEBLE | |
VENTANA | |
PUERTA | |
CARTERA | |
PISTOLA | |
BOTELLA | |
MESON | |
PELUCHE | |
GORRA | |
ARMARIO | |
VELADOR | |
CAMISA | |
PANTALON | |
SABANA | |
RELOJ | |
MEDIAS | |
FUNDAS | |
PAPEL | |
TARJETA | |
ALCOBA | |
TERRAZA | |
PISCINA | |
COMEDOR | |
PARED | |
ANILLO | |
SIRVIENTA | |
MEDICO | |
SARGENTO | |
PUBLICIDAD | |
RECOMPENSA | |
AMISTAD | |
ORDEN | |
RESPONSABILIDAD | |
HONESTIDAD | |
EQUIPO | |
FUTBOL | |
CAMILLA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The_Legend_of_Zelda_Ocarina_of_Time | |
Tetris | |
Super_Mario | |
The_Legend_of_Zelda_A_Link_to_the_Past | |
Chrono_Trigger | |
Street_Fighter | |
Final_Fantasy | |
Super_Mario_World | |
Super_Metroid | |
GoldenEye | |
HalfLife | |
Resident_Evil | |
Metal_Gear_Solid | |
Super_Mario_Kart | |
Super_Mario_Bros | |
Castlevania_Symphony_of_the_Night | |
Super_Mario_Bros | |
Final_Fantasy | |
Pokémon_Red_and_Blue | |
BioShock | |
StarCraft | |
Shadow_of_the_Colossus | |
The_Legend_of_Zelda | |
SoulCalibur | |
Metroid_Prime | |
Doom | |
HalfLife | |
Diablo | |
World_of_Warcraft | |
Super_Mario_World_Yoshis_Island | |
Resident_Evil | |
Donkey_Kong | |
Contra | |
Deus_Ex | |
The_Legend_of_Zelda_Majoras_Mask | |
Super_Smash_Bros_Melee | |
The_Legend_of_Zelda_The_Wind_Waker | |
Pac_Man | |
Halo_Combat_Evolved | |
Space_Invaders | |
Sonic_the_Hedgehog | |
Grim_Fandango | |
CounterStrike | |
Super_Mario_Galaxy | |
Mass_Effect | |
The_Last_of_Us | |
PunchOut | |
Secret_of_Mana | |
The_Legend_of_Zelda_Links_Awakening | |
Star_Fox | |
Star_Wars_Knights_of_the_Old_Republic | |
Portal | |
Metroid | |
Mega_Man | |
EarthBound | |
Resident_Evil | |
Metal_Gear_Solid_Sons_of_Liberty | |
Prince_of_Persia_The_Sands_of_Time | |
Call_of_Duty_Modern_Warfare | |
Dark_Souls | |
The_Elder_Scrolls | |
Ms_PacMan | |
Final_Fantasy_IV | |
Perfect_Dark | |
Advance_Wars | |
Ico | |
Silent_Hill | |
Metal_Gear_Solid_Snake_Eater | |
Shenmue | |
Final_Fantasy | |
Grand_Theft_Auto | |
Double_Dragon | |
Gunstar_Heroes | |
Star_Wars_TIE_Fighter | |
Grand_Theft_Auto_San_Andreas | |
Red_Dead_Redemption | |
Grand_Theft_Auto | |
Galaga | |
Tomb_Raider | |
Final_Fantasy_Tactics | |
Fallout | |
Uncharted | |
Super_Mario_Galaxy | |
Minecraft | |
OutRun | |
RType | |
Batman_Arkham_City | |
Journey | |
Sonic_the_Hedgehog | |
Daytona_USA | |
Kingdom_Hearts | |
Grand_Theft_Auto | |
Nights_into_Dreams | |
Xenogears | |
Robotron | |
Elite | |
Tecmo_Bowl | |
Skies_of_Arcadia | |
Hotline_Miami |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
El Juego de los ahorcados
Python 3
Diviertete